WordPress Can't Upload Images? Here's How to Fix It
parallax background

WordPress Can’t Upload Images? Here’s How to Fix It

WordPress Add Media Button Not Working and How to Fix It
May 27, 2021
Oopsie! WordPress Images Not Displaying So Let’s Fix That
June 29, 2021
 

Are you having difficulty uploading media to your WordPress website?

This issue may seem to come out of nowhere. Often, making changes to a website on WordPress can cause the problem of failing to upload images.

It will need some troubleshooting to find out why media files aren’t uploading to WordPress. But it is easy to fix this problem.

This article lists several potential errors, along with solutions to help fix image upload issues.

Issues Uploading a Single File

If all the files upload except for one, it is most likely one of two errors:

The file size is too large

 

If the file size is too large, increase the maximum upload size, especially when uploading images. The best option to solve this issue is to go to your site's root directory and create a php.ini file.

Upload the php.ini file to the appropriate WordPress folder to allow a larger image size. Add these lines of text to the php.ini file to make adjustments to the file size limit:

upload_max_filesize = 128M post_max_size = 128M max_execution_time = 300

These changes will increase the image upload size limit.

Invalid Image File Name

The file name may be causing WordPress image upload issues. Especially if it contains special characters ($, *, &, # …) or accent letters (ñ, á, é).

If this is the case, rename the file and remove special characters or accent letters. Then upload the file to WordPress again.

Issues Uploading Images to Your Media Library

 

The following error may appear when uploading an image file:

‘Unable to create directory wp-content/uploads/2019/04. Is its parent directory writable by the server?'

There may also be blank images instead of the original images in the WordPress media library. This is most likely an error with the upload folder.

Ensuring the upload folder has the right permissions will likely fix this issue.

Use an FTP client to change the file permission:

 

1. Go to the /wp-content/ folder after connecting to your website through FTP. Then access your wp-content uploads within the uploads folder.

2. Right-click on the uploads directory and select File Permissions.

3. In the file permissions dialog box, type 744 into the numeric value field. Select the option to recurse into subdirectories.

If setting directory permissions to 744 does not work, try 755. Now select the radio button that says 'Apply to directories only.'

 

4. Select OK to use these adjustments. The FTP client will apply file and folder permissions to the directories from now on.

Adjust the file permissions for each file in the uploads directory:

1. Right-click on the uploads directory. Click ‘file permissions’ and change the number to 644 in the dialog box.

 

2. Check the option to Recurse into subdirectories. Finally, click on the ‘Apply to files only’ button and select the OK button to use these adjustments.

Now the FTP client will adjust the permissions for every file within the uploads folder.

Having changed the file permissions, access the WordPress admin area. Try to upload an image file again.

WordPress HTTP Error

 

It is possible to reference an HTTP status code with browser errors. However, it’s a bit trickier to solve when a WordPress HTTP error occurs.

It's even more difficult for those unfamiliar with using debugging mode in WordPress.

Here are a few of the most common issues, and how to fix them:

Reload the Page

 

More often than not, reloading the page can fix the issue. This may sound like a very simple fix, but here’s why to try it:

1. The process may have failed because WordPress lost connection with the browser.

There could be many reasons for this. For instance, an issue with the ISP, a temporary issue with your WordPress host, etc. Reloading the page and re-uploading the media file will allow this error to fix itself.

2. The login session with WordPress may have expired. If this is the case, it will kick you out after you’ve reloaded the page, or you have navigated back from another tab.

So it will be necessary to log in again.

Raise the PHP Memory Limit

 

Limited server resources can affect how applications run. This may cause several errors with WordPress.

Site owners may see that WordPress can't upload images, and it displays an HTTP error message. It’s best to make some adjustments through FTP and increase the PHP memory limit in WordPress:

1. Access your site using FTP and open the folder with all your WordPress files.

2. Add the following code to the wp-config file:

define('WP_MEMORY_LIMIT', '256M' )

This will increase the PHP memory limit to 256M. That will fix a memory-related error with the WordPress HTTP.

Readjust Image Editors to Use a Single Thread

 

Check the default image editor. WordPress uses GD Library and Imagick.

These editors can handle images that use multiple threads, which accelerates image processing.

Unfortunately, not all web hosts allow the multi-thread feature. Therefore, this may lead to an HTTP error when uploading an image file.

To fix this, make the necessary adjustments to the htaccess file.

Open your website through FTP. Open the htaccess file within the WordPress root folder and add the following code:

SetEnv MAGICK_THREAD_LIMIT 1

Check to ensure that this has solved the image upload issue. If not, test the following:

# Exclude the file upload and WP CRON scripts from authentication Satisfy Any Order allow,deny Allow from all Deny from none

Upload Image Files to the Browser

 

A browser uploader can help bypass this WordPress issue.

To switch to the native browser uploader, go to Media > Add New in the WordPress dashboard. Then, click browser uploader.

Disable Plugins

 

Plugins may cause unintended issues, especially some that deal with images.

Deactivate image optimization plugins, security plugins, etc. Then try uploading the files.

This should do the trick. Contact the plugin developer for further help if needed.

Change the WordPress Theme

 

Your WordPress theme may be causing the issue. To test this, first create a backup of your site.

Temporarily set your WordPress site to a default theme like Twenty-Twenty. After this, check if the image uploads properly and your site still works as expected.

Are You Using a Caching Plugin?

 

A caching plugin can sneakily cause a few issues, luckily it has a pretty simple solution. Try clearing the cache and browser history.

Then revisit the media uploader to try uploading the image again.

Do You Have the Latest PHP Version?

 

Most will likely encounter issues if their PHP version is lower than 7. Although WordPress does work with older versions of PHP, it recommends PHP 7.4 at the least.

Many web hosts provide an option to change the version of PHP from their hosting dashboard. For further help with this issue contact your web host.

Get Help from Your WordPress Host

 

If WordPress HTTP error messages still appear, it might be wise to contact your WordPress hosting provider. Do this before making any further changes.

The other solutions are a bit more complicated. So it will be more helpful to reach out to your WordPress hosts than try to solve them alone.

Ending thoughts on WordPress can't upload images error

The "WordPress can't upload images" error is common, especially for regular WordPress users. But with the right techniques, it is possible to fix an image upload issue.

The tips in this article will help with any current and future image upload issues.

If you enjoyed reading this article on WordPress can't upload images error, you should check out this one about WordPress add media button not working error.

We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, how to reorder pages in WordPress and WordPress updating failed error.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 230,000+ customers.

Comments are closed.

Free cheat sheets available

Subscribe to download a set of cheat sheets for CSS, JS, and HTML

You'll receive an email with the cheat sheets in an instant.