move_uploaded_file

杀马特。学长 韩版系。学妹 提交于 2019-12-08 10:59:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!