Error "file is empty" when uploading images in WordPress

I am running a WordPress 2.9.2 blog with a custom Debian installation on an Amazon Web Services EC2 machine.

Everything worked fine until Monday. Then came Tuesday, and suddendly, overnight, I can’t upload photos using the default WP file downloader (either flash or html).

When I try to upload an image, it displays the following error:

The file is empty. Download something more substantial. This error can also be caused by disabling downloads in your php.ini or post_max_size, defined as less than upload_max_filesize in php.ini

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

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

But that did not work. Then I tried chmod - the wp-content / uploads / folder and its subfolders in 777 . Does not work.

Did some research on Google and added the 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> 

Does not work. Finally, the increased WP memory limit in the wp-settings.php file. Does not work.

So now I have no options. Anyone have any ideas on how to solve this? It really annoys me and my client!

Thanks in advance!

+4
source share
4 answers

I’m not sure that this was so (more than a year has passed), but in many cases for the same problem the problem was that the hard drive was full .

Stupid, I know.

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

+3
source

First I created the phpinfo.php file and put it in it:

 <?php phpinfo(); ?> 

I accessed the page (I use wamp) in localhost / phpinfo.php and checked

 upload_max_filesize: post_max_size: memory_limit: 

I found the location of php.ini and changed these variables up to

 upload_max_filesize = 100M post_max_size = 100M memory_limit = 128M 

Then I restarted apache and checked that phpinfo.php reflects the new settings. I still get the error message, so I changed the directory for the site and all the read-only and read-write subdirectories. It seemed like a trick.

+1
source

Have you tried installing the latest version on the same server (installing vanilla) and trying? From .. disable plugins to find out if they are the cause of this?

0
source

I had a similar problem. I get the message "empty file" and reload the same file, which simply reports a warning. There are many messages saying that "media xxxx already exists", and after checking all the messages were imported with all attachments. So basically I had to download each import file twice, but the second time it was faster. Hope it helps.

0
source

Source: https://habr.com/ru/post/1394420/


All Articles