FILES array empty in php when uploading .zip, while .jpg works fine

I am running php 5.3, and have bumped into a problem I've not encountered before. I have an upload form (yes, enctype is set to multipart/form-data), that posts stuff to a php page.

The php installation has uploads enabled, and upload_max_filesize is set to .5GB.

Uploading pictures (I've tried up to 50 at a time) works fine. Uploading .zip files, however, does not. Uploading a .zip will render most global input arrays ($_POST,$_GET,$_FILES, and $_REQUEST) completely empty. A network sniff shows POST data beeing sent, as well as the zip beeing uploaded.

Apache logs show nothing out of the ordinary, and no errors are encountered. The arrays are just empty. Has anyone encountered this?


I don't have a clue what the exact problem could be, but I'd suggest trying out a few modifications on the files:

  • can you upload a .jpg file that you've renamed to .zip?
  • can you upload a .zip file that you've renamed to .jpg?
  • try uploading a smaller .zip file, just to make sure it does actually get transfered.
  • try uploading a .jpg with a bigger filesize
  • Hopefully this will give a pointer about where the problem lies. For what it is worth, I doubt that the problem is in PHP.


    I had recently encountered this same issue in php7.0. When I tried to upload 0.7G zip- $_POST,$_REQUEST and $_FILES were all empty but increasing upload_max_filesize and post_max_size values to correct limit in php.ini and restarting php7.0-fpm fixed it.

    Hope this helps someone!!!


    <?php
    
    set_time_limit(0); // Make sure php doesnt end script after 30 seconds
    ini_set('upload_max_filesize', '100M'); // Set default file upload size to 100 megs
    
    ?>
    
    链接地址: http://www.djcxy.com/p/69742.html

    上一篇: 在PHP中显示按钮下方的上传文件名

    下一篇: 上传.zip时,php中的FILES数组为空,而.jpg正常工作