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

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

    Thank you everybody for the vary comprehensive replies. Those are all very helpful. The answer turned out to be something very odd. It turns out that PHP 5.2.11 doesn't like the following:

    post_max_size = 2G
    

    or

    post_max_size = 2048M
    

    If I change it to 2047M, the upload works.

    0 讨论(0)
  • 2020-11-21 23:39

    I have a same problem looking 2 hours ,is very simple to we check our server configuration first.

    Example:

    echo $upload_max_size = ini_get('upload_max_filesize');  
    echo $post_max_size=ini_get('post_max_size');   
    

    any type of file size is :20mb, but our upload_max_size is above 20mb but array is null. Answer is our post_max_size should be greater than upload_max_filesize

    post_max_size = 750M  
    upload_max_filesize = 750M
    
    0 讨论(0)
  • 2020-11-21 23:39

    I was struggling with the same problem and testing everything, not getting error reporting and nothing seemed to be wrong. I had error_reporting(E_ALL) But suddenly I realized that I had not checked the apache log and voilà! There was a syntax error on the script...! (a missing "}" )

    So, even though this is something evident to be checked, it can be forgotten... In my case (linux) it is at:

    /var/log/apache2/error.log
    
    0 讨论(0)
提交回复
热议问题