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

前端 未结 21 2708
一向
一向 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:13

    As far as the HTML you appear to have set that part up correctly. You already have the enctype="multipart/form-data" which is very important to have on the form.

    As far as your php.ini setup, sometimes on systems multiple php.ini files exist. Be sure you are editing the correct one. I know you said you have configured your php.ini file to have file uploads, but did you also set your upload_max_filesize and post_max_size to be larger than the file you are trying to upload? So you should have:

    file_uploads = On; sounds like you already did this
    post_max_size = 8M; change this higher if needed
    upload_max_filesize = 8M; change this higher if needed
    

    Does your directory: "c:\wamp\tmp" have both read and write permissions? Did you remember to restart Apache after you made the php.ini changes?


提交回复
热议问题