How to Fix Image Upload Issues in WordPress

How to Fix Image Upload Issues in WordPress

How to Fix Image Upload Issues in WordPress

If you are unable to upload images in WordPress, you are no doubt wondering what is causing the issue and how to fix it.

WordPress image upload errors can begin unexpectedly, or in some cases, after you make changes to your site. Either way, it takes some effort to find out why WordPress cannot upload images and to resolve it.

In this article, we have grouped the solutions according to the errors you may be getting. This grouping will help you identify the most likely solution for the particular errors when uploading images you are facing.

Content

Common Image Upload Errors and How To Fix Them

  1. When you cannot upload a particular file
  1. When you get file size errors
  1. When you cannot upload (and your media gallery shows blank images, or you recently migrated to another host)
  1. When you are getting an HTTP error:
  1. Other Solutions

Common Image Upload Errors and How To Fix Them

From experience, some WordPress image upload issues are easier to resolve when you know which solutions to try first. The solutions have thus been grouped according to the errors you may be seeing.

Note however that all the solutions can work for any errors, so if the recommended solutions for your issue don’t fix it, go on to try all others.

When You Cannot Upload a Particular File

If you are seeing this issue with one file but all others upload properly, then there are two easy solutions to fix this.

Resize the image

One reason a particular image file may not upload is because the image dimension are too large. To fix this, resize your image to make it smaller. You can do this with any image editing software, or even easier, simply use Picresize online tool to fix the issue.

Rename the image

If the file name contains special characters ($, *, &, # …) or accent letters (ñ, á, é …), rename the file to remove these characters and then upload to WordPress.

When you get file size errors

This happens when the image you are trying to upload is larger than the file size limit for uploads.

Increase max file size

To increase max file size, check your main WordPress folder for your php.ini file and add this text to it (if you cannot find the file, create a php.ini file, paste in this text, and upload it to your main WordPress folder):

upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300

 

This would increase your limit and you should be able to upload your images.

Note that some webhosts prevent you from increasing upload size limit. If you tried increasing and it doesn’t work (check by going to Media > Add New), you would need to ask your host to increase it for you.

When you cannot upload (and your media gallery shows blank images, or you recently migrated to another host)

If you having upload issues, and instead of seeing proper images in your gallery, you see blanks like the picture below, then the issue is likely from your upload folder.

Blank Media Gallery - How to fix image upload issues in WordPress

To fix this, you have to ensure your upload folder has the right permissions.

Change file permission for upload folder

To set the correct permissions, access your WordPress files using FTP.

Next, locate your “wp-content” folder and double click to open it.

Access wp content folder - How to fix image upload issues in WordPress

In this folder, locate your “uploads” folder, right-click on it, and select File Permissions.

Change file permssions - How to fix image upload issues in WordPress

Set the numeric value to 744, tick “Recurse into subdirectories”, select “Apply to directories only”, and click OK.

Set file permissions - How to fix image upload issues in WordPress

Now reload your library to see if your images display, and then try uploading a file.

Note: In some cases, setting to 744 may not fix your issue. If this happens, repeat the process but this time set the permission to 755.

When You Are Getting an HTTP Error When Uploading

An HTTP error can be caused by a number of issues, some of which we have considered above. However, the two most likely causes are (1) WordPress memory problems. (2) Multiple threads in your image processor.

Increase the memory limit

Low memory in WordPress could lead to many issues, one of them WordPress images not uploading, and you seeing an HTTP error instead. The memory we’re referring to here is the one used to run applications on your server, and is different from the max file size we increased above.

To increase WordPress memory, access your site using ftp and open the folder containing your WordPress files.

In this folder, locate and edit your wp-config file to include the following code:

define( 'WP_MEMORY_LIMIT', '256M' )

This increases your PHP memory limit to 256M and would fix your issue if it was memory related.

Set the image processor to use one thread

Imagick is one of the two image processors WordPress uses to handle images. This processor was designed to use multiple threads to speed up image processing. However, multi-thread feature is restricted by some web hosts and this could lead to HTTP error when you try to upload.

To fix this issue, access your website using ftp. Next, locate your htaccess file and edit it to include the following configuration.

SetEnv MAGICK_THREAD_LIMIT 1

Now try uploading an image to see if the error is fixed.

Other Solutions

Here are two more solutions you can try.

Use the browser uploader

The native browser uploader can help get you around uploading issues in WordPress. Follow these steps to switch to the native uploader.

In your dashboard, go to Media > Add New.

Next, click browser uploader.

Use Browser Uploader - How to fix image upload issues in WordPress

Try uploading this way to see if it fixes your issue.

Clear cache if you are using a caching plugin

Some WordPress users have been able to fix this issue by simply clearing the cache on their caching plugin.

If you are using a caching plugin, try this to see if it fixes your issue.

Disable Plugins

In some cases, you can resolve image upload issues by disabling all your plugins and then gradually tracing the plugin causing the issue. Read this guide to learn how: How To Disable WordPress Plugins Using FTP.

Conclusion

The steps covered in this guide have shown you how to fix image upload issue in WordPress. However, image upload problems can sometimes be difficult to diagnose and fix.

If you still can’t upload images to WordPress media library, then you may need expert help. Request our service and one of our developers will get to work immediately to fix your issue.

You may also try contacting your web host. They may know if there are configurations or fixes that are unique to their servers. If you have fixed this issue using methods not covered in this guide, please share them with our readers in the comments below. For more WordPress tutorials and step by step guides check our WP College blog.