Why would $_FILES be empty when uploading files to PHP?

前端 未结 21 2924
一向
一向 2020-11-21 22:37

I have WampServer 2 installed on my Windows 7 computer. I\'m using Apache 2.2.11 and PHP 5.2.11. When I attempt to upload any file from a form, it seems to upload, but in PH

21条回答
  •  时光取名叫无心
    2020-11-21 23:31

    No one mentioned this but it helped me out and not many places on the net mention it.

    Make sure your php.ini sets the following key:

        upload_tmp_dir="/path/to/some/tmp/folder"
    

    You'll need to check with your webhost if they want you to use an absolute server file path. You should be able to see other directory examples in your php.ini file to determine this. As soon as I set it I got values in my _FILES object.

    Finally make sure that your tmp folder and wherever you are moving files to have the correct permissions so that they can be read and written to.

提交回复
热议问题