Updated on Aug 16, 2019
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.
In this post, we will cover:
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.
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.
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:
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:
Do the above and you are done with this case.
wp-content
folder via the terminal command:
cd /home/$USER/public_html/wp-content
find . -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644it fixes all files and folders permissions to their default, including the
uploads
folder.cd /home/$USER/public_htmland then run:
chown -R $USER: wp-contentdoing that will fix the ownership of all files and folders recursively.
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.
We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!