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:
โ
โ
โ
Send this file:
โ
โ
โ
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 "";
โ
?>
โ
โ
Opinions expressed by DZone contributors are their own.
Comments