How to fix problems with image upload in WordPress

There is a specific issue that can occur while trying to move newly uploaded files to your WordPress website. It says:

“The uploaded file cannot be moved to wp-content/(the upload folder)”
An extra side effect of this error is the fact that you cannot update existing plugins automatically, or add some new ones. If you try, for example, adding a new plugin, WordPress will present you with an FTP credentials screen for you to upload the new plugin manually.


This post will cover the following:

  • What Causes The Image Upload Issue in WordPress?
  • Changing the File/Folder Permissions is a Bad Advice
  • Fixing the Upload Issue in WordPress
    1. Refresh the page
    2. Fixing "Upload folder is not writable" in WordPress
    3. Fixing "The uploaded file cannot be moved to wp-content/(the upload folder)" via the cPanel Terminal
    4. Resize the image


What Causes The Image Upload Issue in WordPress?

Let’s say you have a migrated WordPress site that was working correctly with your previous host. In that case, the issue with an error message “The uploaded file cannot be moved to wp-content/(the upload folder)” is happening most likely because WordPress passes off the uploading of your requested file to the web server process on which your site resides. The process receives the image from your hard drive and uploads it to the server’s temporary memory.

Then, WordPress tries to commit your file into the storage of the media library, and there comes the error. The account that is actually retrieving your file is none other than the Apache Service Account (aka the Nobody account) on the server itself. You get the error message because that particular account has no rights to the /wp-content/uploads/<year>/<mo> folder. The message indicates that there was an issue placing your file in the specific folder. This comes by design, and it means that your web server is enforcing the security parameters that it’s supposed to, which is definitely not a bad thing.


Read more WordPress tutorials:

How to enable SSL on your WordPress website and move from http to https

How to enable and disable pingbacks and trackbacks in WordPress

How to safely disable the WordPress automatic update feature


Changing the File/Folder Permissions is a Bad Advice

The Internet is full of recommendations on how to fix the issue. Most of them suggest resolving the problem by changing the permissions on the folder /wp-content/uploads to 777. This is not a good idea. It will fix your issue, but your folder’s availability will be changed. In short, the 777 permission means making the file/folder readable, writable and executable by everyone. For security reasons, better go with another method and actually resolve the issue as it’s supposed to be done.


Fixing the Upload Issue in WordPress

There are two possibilities when facing the upload issue. Follow our guide, and you will be ready in no time. Here is what you do for each possibility:


Refresh the Page


This should be the very first thing you should do when encountering the WordPress HTTP error is to simply refresh the page in your browser. Well, actually this is the most common fix we’ve seen for it. Here’s why:

First, for whatever reason, your browser might have lost connection temporarily with WordPress and the process simply failed to complete. This could be due to your ISP, a temporary hiccup with your WordPress host, etc. If you refresh the page and try uploading again it the error sometimes will resolve itself.

Second, we’ve also seen that sometimes after refreshing the page, or coming back to the WordPress editor from another tab, that it suddenly kicks you out. This is most likely an indicator that your WordPress login session has expired.

So naturally, you log back in and try to upload your media again. However, the HTTP error occurs. This is kind of a quirk with WordPress. Once you log back in, you need to actually manually refresh the page you’re on. Then uploading media will work again.


Fixing "Upload folder is not writable" in WordPress

This is the most commonly seen case (80% of the time). It can occur when trying to upload media or plugins and themes. The error message may also read: “Unable to create directory.” Most of the time, it happens after a WordPress site has been moved, migrated from a developer to your account, or moved from one web host to another. There is an upload path that is stored in the database. It's in order for WordPress to know where to put your files once you upload them in the WordPress Admin. When you migrate a site from one hosting account to another, that upload path is not going to be the same and therefore WordPress can not “write to that path”.

The error message may also read, “Unable to create directory…” To fix this, you need to:

  • Go to the WordPress Admin Board;
  • Click on Settings;
  • Click on Media;
  • Look for Upload Files Section;
  • Look for Store Uploads in this Folder;
  • Replace what you have there with "wp-content/uploads" (remove the quotes);
  • Click on Save Changes;

Do the above and you are done with this case.


Read more WordPress tutorials:

Configuring the basic settings in your WordPress website

How to Backup Your WordPress Website Automaticaly Using Backup Plugins

How to Backup and Restore the backup of a WordPress Website


Fixing "The uploaded file cannot be moved to wp-content/(the upload folder)" via the cPanel Terminal

  • Go to cPanel and open the Terminal. If you are not a tech-savvy person, do not worry, what you need to do in the Terminal is simple;
  • After you have opened the Terminal, the next thing you will be doing is setting all your files and folders default permissions to 644/755. To do that, you need to go to the wp-content folder via the terminal command:
    cd /home/$USER/public_html/wp-content
  • Follow this by inputting the command line:
    find . -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644
    it fixes all files and folders permissions to their default, including the uploads folder.
  • Still in the Terminal, go to the public_html folder by using the command:
    cd /home/$USER/public_html
    and then run:
    chown -R $USER: wp-content
    doing that will fix the ownership of all files and folders recursively.
  • What you did should be enough to fix the issue. However, in case it does not, there is also a case where a theme/plugin could be causing the upload error message. Try disabling all plugins temporarily and upload your files again. If there are no issues now, it means that you know the source - a plugin or a theme. In case the error message “The uploaded file cannot be moved to wp-content/(the upload folder)” persists, the problem is probably on a server level and you should turn to our technical support team.


Shrink or Resize the File


You might need to edit your image file, which could entail reducing the file size (KB or MB) or decreasing the width/height (pixels). We recommend checking out our in-depth post on how to optimize images for the web. There are a lot of third-party image optimization plugins you can use to automatically do this for you (both reducing and resizing) when your image is uploaded to the media library.

Imagify works excellently well without issues. But there are a lot of other great ones out there as well. Just make sure whichever plugin you use, that they are optimizing images on their own servers, not locally. If you’re bulk optimizing images locally this can drastically harm your site’s performance.


Rename the Image File

It can never hurt to try and rename the image file. WordPress should automatically append a number on the end if you try to upload a duplicate file name, but in case that doesn’t work, try renaming your file. Unfortunately, WordPress doesn’t let you rename the file of an already uploaded image file, so you will need to rename it locally and re-upload it.

When uploading images that already exist, typically add a -1 or -2 on the end (example: image-file-1.png, image-file-2.png). Make sure to add the dash otherwise Google will read it as one word and it could hurt your SEO.

Also, to be safe, stay clear of uploading an image with file names that contain special characters. This includes international language symbols and characters such as apostrophes. Dashes are OK. While WordPress can technically support these, there are a lot of other issues that can pop up.


Temporarily Deactivate Plugins and Themes

It’s always a good idea if you’re having HTTP errors to try deactivating your plugins and even switch your WordPress theme to the default to see if this resolves the problem. A few plugins that are are typical culprits include image optimization plugins (they tie directly into the media library) and security plugins such as WordFence (these plugins are sometimes too restrictive). Or you can simply delete your WordPress theme.

If you don’t want to affect your live site, simply clone your live site to a staging environment. If the WordPress HTTP error is also happening on staging, then you can quickly deactivate all your plugins to start narrowing it down.

Remember, you won’t lose any data if you simply deactivate a plugin. If you can still access your admin, a quick way to do this is to browse to “Plugins” and select “Deactivate” from the bulk actions menu. This will disable all of your plugins.

If this fixes the issue you’ll need to find the culprit. Start activating them one by one, and try uploading an image again in the media library. When you see the HTTP error return, you’ve found the misbehaving plugin. You can then reach out to the plugin developer for help or post a support ticket in the WordPress repository.

If you can’t access your admin you can FTP into your server and rename your plugins folder to something like plugins_old. Then check your site again. If it works, then you will need to test each plugin one by one. Rename your plugin folder back to plugins and then rename each plugin folder inside of if it, one by one, until you find it. You could also try to replicate this on a staging site first.

The same goes for your WordPress theme. Typically themes don’t tie into the media library, but we’ve seen some weird setups. It never hurts to try switching your theme over to the default Twenty Seventeen theme to see if it fixes it. Just like with plugins, you don’t have to worry about losing your current theme settings. All of that is stored in the WordPress database.


Contact Us for Assistance

In case you’ve done everything in your post, but your problem persists, feel free to open a support ticket. Our expert technical support staff works 24/7 and will be happy to investigate the issue for you further. Make sure to explain what you want, as well as everything you’ve already tried. This way, the team will act quickly, and the issue will be resolved in a more timely manner.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to create and manage a page in WordPress

Creating pages in WordPressCreating individual pages in WordPress is quite similar to writing a...

Changing your WordPress website location

If you want to change the location of your WordPress website, this tutorial will guide through...

Configuring the basic settings in your WordPress website

This tutorial shows you how to configure the basic settings of your WordPress website. This...

How to create a simple portfolio website with WordPress

Installing WordPress on Todhost is simple and easy. It is part of our free software fould under...

How to control new user registration in WordPress

One problem plaguing WordPress especially membership sites that take user registrations is spam...