Unable to create directory wp-content/uploads/2013/10. Is its parent
directory writable by the server?

If you are, like me, fond of frequently shifting your websites from VPS to VPS, using Centos and Ubuntu, alternatively, you will face this problem.

Suddenly, when I tried to upload an image to my WordPress site, I got the error:

Unable to create directory wp-content/uploads/2013/10. Is its parent directory writable by the server?

Well, I did all the usual things – check that the ownership of the files is with www-data:www-data (if Ubuntu) or apache:apache (if Centos) or name_of_user:name_of_user (if using VirtualMin). I also chmoded the files to an extreme 777.

In desperation, I even manually created the folders. But I still got the error:

Unable to create directory wp-content/uploads/2013/10. Is its parent directory writable by the server?

Well, after a lot of hair-tearing, I discovered that the answer is that the folder layout for the media files was incorrectly set. When I peeped into Settings >> Media, it asked me: Folder for Media Files Is