+44 (791) 5698 086

Nginx – The uploaded file could not be moved to wp-content/uploads [solved]

While trying to upload the image in my WordPress post, I received an error saying:

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

nginx The uploaded file could not be moved to wp content uploads

Server Configuration

The server which got this error is:

  • vps (unamanged with ssh/root access)
  • ubuntu 14.04 minimal
  • nginx with php-fpm and mysql
  • NO ftp
  • WordPress 4.0

The directories were in standard file permission when I moved the files to the vps.

Solution

The solution to this error is quite simple. While surfing around the net I found out some people suggesting making your uploads directory 777, well that’s the worst idea of all. What’s the point in making your whole server vulnerable, just to upload an image. In fact why to chmod it 777 and make it writable to the public when you can simply make it writable by your WordPress only?

The solution to fix this error is simply logging into your ssh via terminal or any other client, and running the following command to allow your WordPress to write itself on the directory (copying exactly what I did):

chown -R www-data:www-data /var/www
chown -R www-data:www-data /var/www/websitename/path/to/wp-content/

Please note, if you’ve changed the root user (which is a good thing) then you would have to use “sudo” before these commands.

Also, note that I used path to wp-content. Now I’m not sure if the first command will fix it for your or not, I just ran it anyway to fix the issue.

Hope it solves “The uploaded file could not be moved to wp-content/uploads” issue for your WordPress on nginx.

 

2 Responses to Nginx – The uploaded file could not be moved to wp-content/uploads [solved]

  1. DevOps

    Thanks for the solution. It worked.

    • Nabtron

      Welcome bro! I’m glad that it was helpful!

Leave a Reply

Your email address will not be published. Required fields are marked *

Who are we?

Nabtron team includes web, desktop software and mobile apps developers along with SEO professionals.

We are available 24 hours, 7 days a week. Contact us now for anything you need!

Join our mailing list

Lets become friend :) What's your name & email?