Very Simple Php File Upload
Join the DZone community and get the full member experience.
Join For FreeI think this is the minimum necessary to upload a file in php. First, the form, index.php:
Next, the php to accept the file, upload.php
";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
echo "";
echo '';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "
";
?>
Upload
Opinions expressed by DZone contributors are their own.
Comments