问题
I have a form with 3 tabs, one for pictures, one for music and one for youtube. The first 2 are forms where people can upload files, the second is just for a youtube link.
When people hit the 'upload' button they are sent to a second page where the actual uploading is done. Now uploading musc works, but using the same code for the pictures it doesn't seem to work.
if (isset($_POST['submitfoto'])) {
// uploaden
$target_path = "uploads/";
$target_path = $target_path . time() . $_SERVER['REMOTE_ADDR'] . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
// Here I do a bunch of stuff with the database, but it never gets that far.
echo "Thanks for uploading this file.";
} else{ echo "File upload failed";} }
Now I get File upload failed all the time. But the exact same code seems to work for uploading .mp3 file.
How is this possible?
来源:https://stackoverflow.com/questions/10938408/move-uploaded-file