How to fix "The uploaded file could not be moved to wp-content/uploads/"

If you work with WordPress for your business or personal website, at some point you will likely come across this error when trying to upload new media to your Media Library:

“image.png” has failed to upload.
The uploaded file could not be moved to wp-content/uploads/2017/06.

WordPress media

You may also see errors like this when trying to add a file:

WordPress upload error

To top if off, you will also have issues updating plugins automatically or updating the theme. It will say something like:

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

file not uploaded to WP

Why does this happen?

This is basically the security of WordPress at work. Your web server is enforcing the permissions it is aware so it is generally a good thing. It does not help you with uploading those images or updating the plugins.

How NOT to fix this problem

There is plenty of discussion on the internet regarding this problem. I have seen quite a few posts simply suggesting that you change permissions on your /wp-content/uploads folder to 777. This is a really bad idea and will likely lead to your WordPress site becoming hacked. Do NOT change permissions on your /wp-content/uploads folder to 777.

How to fix the problem

If you running your WordPress website on a shared hosting server then you may need to submit a support ticket or send an email to support to get this error taken care of. Some shared servers do have some form of SSH access so to get started open or download then open the Putty program on your computer and log in.

Once logged in as root, execute this command:

ps aux | egrep '(apache|httpd)'

This will show what user apache is running as. Usually nobody.

You can then simply give the user "nobody" rights to upload images to the directory.

This can be done running the following command:

chown -R nobody /home/_serverusername_/public_html

Be sure to change serverusername with your actual server username. This is what you use to login to cPanel and can also be seen in the path to your server.

  • 331 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

Attachments received renamed to "winmail.dat"

This issue may occur if all of the following conditions are true: The email message is sent to...

I'm having issues composing messages in Webmail

If you're having issues composing mail in Webmail, there are a few things you can try: Make...

My contacts aren't syncing with my phone

If Mobile Sync is not active, that means it is not possible to synchronize your Contacts between...

I am getting a password prompt in Outlook

Here are some troubleshooting tips to follow if you are still having trouble accessing your...

My signature does not appear when composing a new message

If you're having trouble with your existing signature, create a new signature by following the...