Error "file is empty" when uploading images in WordPress

22,358

Not sure if this was the case (it has been over a year), but in many cases, for this same issue, the problem was due the hard drive being full.

Stupid, I know.

Just check how much space is left, and, if none, go delete logs. Apache, PHP, MySQL. They add up a lot of data when enough time is given.

Share:
22,358
Armin Cifuentes
Author by

Armin Cifuentes

🍻 Here's to all those sleepless nights aborted by a generous answer. #SOreadytohelp

Updated on December 22, 2020

Comments

  • Armin Cifuentes
    Armin Cifuentes over 3 years

    I'm running a WordPress 2.9.2 Blog with a custom install of Debian in a Amazon Web Services EC2 machine.

    Everything was working fine until monday. Then came tuesday, and suddendly, overnight, I can't upload pictures using the default WP file uploader (either flash or html).

    When I try to upload a picture, it displays the following error:

    File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini

    So I checked out my php.ini, and modified some settings as follows:

    • upload_max_filesize: 64M
    • post_max_size: 90M
    • memory_limit: 128M
    • max_excecution_time: 600
    • max_input_time: 600

    But it didn't work. Then I tried chmod -ing the wp-content/uploads/ folder and its subfolders to 777. Didn't work.

    Did some research on Google, and added following lines to .htaccess:

    <IfModule mod_security.c>
    SetEnvIfNoCase Content-Type
    "^multipart/form-data;" "MODSEC_NOPOSTBUFFERING=Do not buffer file uploads"
    </IfModule>
    
    <IfModule mod_gzip.c>
    mod_gzip_on No
    </IfModule>
    

    Didn't work. Finally, increased WPs memory limit in wp-settings.php file. Didn't work.

    So I'm all out of options by now. Anyone has any ideas on how to solve this? It's really bugging me and my client off!

    Thanks in advance!