PHP: File upload move_uploaded_file() not working

前端 未结 2 382
无人共我
无人共我 2021-01-13 05:17

I just made a file upload code and I was wondering why the file upload wasn\'t working. I changed the upload dir to 0777. This is my upload HTML code:



        
相关标签:
2条回答
  • 2021-01-13 05:47

    Your

    if (file_exists("/files/".$_FILES["file"]["name"]))
    

    will always return false. The file is saved with its temp name.

    Try

    if (is_uploaded_file($_FILES["file"]["tmp_name"]))
    

    instead.

    0 讨论(0)
  • 2021-01-13 05:59

    Try

    move_uploaded_file($_FILES["file"]["tmp_name"],"filebro/".$_FILES["file"]["name"]);
    
    0 讨论(0)
提交回复
热议问题