A fresh mix of code snippets and tutorials

WordPress Fix Image Upload Errors

Here are some quick tips to help troubleshoot and fix image and file upload errors in WordPress. Hopefully it helps someone out there get things back on track with their uploaded images. I know it can be frustrating!

HTTP errors during image upload

HTTP errors generally happen when trying to upload images and files that are too large for the server to handle. This could be because of server settings, memory resources, and so forth. Here are some things to try.

Important! Always make a backup of any files that you will be modifying. That way, if there is any issue because of the changes, you can easily roll back to the previous working environment.

Decrease image size

If your image is too large, try reducing its size. This is probably the easiest solution. Here are some tips:

  • Use Photoshop, Preview (Mac), or Paint (Win) to decrease image size
  • Your WP theme may provide a way to decrease image size
  • Try finding a WP plugin that edits images, decreases size, etc.
  • Or just grab a super-small image and give it a try

So the easiest thing to do for images that are too large is to reduce their size. But of course, that’s not always ideal, so let’s look at some other ideas..

Increase PHP Memory

If the image you are uploading is too large, most likely it’s because the server configuration has some set limit for maximum uploaded file size. Here are some things to try.

  • Increase memory by adding define('WP_MEMORY_LIMIT', '256M'); to your site’s wp-config.php file (adjust 256M as needed)
  • Increase memory by adding php_value memory_limit 256M to your site’s root .htaccess file (check for compatibility first)
  • Increase memory by adding memory_limit = 256M to your site’s php.ini file (if available/accessible)
  • If in doubt, contact your web host and ask for help

For more information on these techniques, check out my tutorial at Perishable Press for increasing PHP memory for WordPress.


If your server is running ModSecurity, it may be interfering with file uploads. If you think this might be the case, you can temporarily disable it by adding the following directives to your site’s root .htaccess file:

<IfModule mod_security.c>
	SecFilterEngine Off 
	SecFilterScanPOST Off 

If you get an error after adding this code, simply remove it. Otherwise, it’s worth a shot to diagnose any ModSecurity issues.

HTTP Authentication

If your site is using any king of HTTP access control, like an HTTP password prompt, it could be interfering with WordPress functionality such as the Uploader, Cron, and XML-RPC. In order to resolve this issue, you can explicitly allow the files that are required for these features to work properly. To do so, add the following directive to your site’s .htaccess file:

<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)">
	Satisfy Any
	Order Allow,Deny
	Allow from all
	Deny from none

Plugin/Theme Conflicts

In many cases, issues and broken things are caused by conflicts involving plugins and themes. If you are running anything other than the default WP setup, it’s definitely worth checking your plugins and themes to see if there is any issue. Here is a troubleshooting guide I recently shared at Perishable Press that can help those who may be new to the game.

Missing Images

If you are unable to upload images, or are seeing missing/404 images, or are unable to add new folders, or anything along those lines, most likely there is an issue with file permissions. You may get error messages such as, “Unable to create directory”, “is the parent directory writable by the server”, or similar. If that sounds like you, here are some tips for setting proper file permissions..

  • The WP Media Library uses the /wp-content/uploads/ directory
  • Log in to your site via the server control panel or via SFTP. Then navigate to the file browser and inspect the permissions of your uploads folder.
  • Here is the official WordPress guide to setting proper file permissions
  • If in doubt, ask your web host for help

Setting proper permissions on directories is an important part of web-based operations. If you are unfamiliar with the topic, definitely take a few minutes to study up and learn how it works. It’s a great tool to have in your belt.

Upload Max Filesize

If you are getting an error that says something like, “maximum upload size exceeded”, your server configuration (e.g., the php.ini file) is limiting the amount of “stuff” that you can upload. Try checking your server configuration for the following directives:

  • upload_max_filesize
  • post_max_size
  • max_execution_time
  • max_input_time

For example, you can increase the limits of these directives via your site’s php.ini file:

upload_max_filesize 64M
post_max_size 64M
max_execution_time 500
max_input_time 500

Alternately, you can increase the limits by adding equivalent directives via your site’s .htaccess file:

php_value upload_max_filesize 64M 
php_value post_max_size 64M 
php_value max_execution_time 500 
php_value max_input_time 500

Of course these values are for example; you’ll want to customize each of the directives according to your specific requirements.

Again, if any of these concepts are beyond your understanding, best advice is to ask your host and/or do a little research to learn the basics.

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress