Cannot upload images in WordPress – File is empty error

Holy cow. Want to talk about a difficult error to diagnose and correct! When you can upload teenie tiny images, but anything larger than even 30k throws an error in WordPress, you just about want to pull your hair out. The error we’re talking about is this:

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

The hardest part about correcting this error? That the very suggestions it makes within the error message itself to correct it, don’t work. And there are years and years of threads all over the web that talk about this problem, none with solutions. We eventually solved this problem when it manifested on a long time client’s site (their site was from 2010!) by doing a fresh installation of WordPress. Once we did that and connected up the database and content files, it worked. This was after days and days of struggling to figure out what the heck was going on and thinking it was a server-side issue. After all, that’s what the error says – update your server files! 

So how do you fix this?

The short answer is the problem is in your wp-admin and wp-includes folders. The reason the fresh installation of WordPress worked (well, we’re at least 90% sure this is correct) was because of the new the media.php, media-new.php, and media-upload.php files. You still might as well replace all of your wp-admin and wp-includes folders however, because the error itself is actually thrown from the wp-admin/includes/import.php file. And chances are you’re probably updating your WordPress install anyway if you’re in this boat, so doing a full fledged manual update is the way to go – not replacing individual files.

  1. Head over to WordPress.org’s site, and grab a fresh copy of WordPress by downloading and unzipping it.
  2. Backup your entire wp-content folder, any files you’ve customized outside of that folder, and for kicks, also your database. It shouldn’t be affected at all by what you’re doing, but backups are amazing to have for that one… oh crud… moment.
  3. Then open this in another browser tab and follow the directions verbatim: https://codex.wordpress.org/Updating_WordPress#Manual_Update
  4. As soon as you replace your wp-admin and wp-includes folders you should start to see the image file uploads begin to work.

So the solution really isn’t that terrible, but there is just so little direction on this problem that we wanted to put something out into the community for others struggling with this issue.

Thanks for stopping by, and if you run into any issues drop a comment or hit us up on twitter @creationdepot.

Have a good one!

Wendy

2017-06-18T09:31:33+00:00

About the Author:

  • Raretestvogel

    Thank you! Simply replacing the media php-files did the trick for me. What an annoying time-consuming problem and definitely worth a slap in the forehead for being so easy to fix.

    • Wendy Litteral

      No kidding! And good to know you were able to get it with just replacing the media php files! Thanks for commenting!!