WordPress files upload failed after host migration
If you are experiencing issues with files upload in wordpress, even after checking all the permissions, then you might be wondering what’s the problem.
Unable to Create Directory wp-content/uploads. Is its Parent Directory Writable by the Server
Questions to you:
- Have you moved your host recently?
- Have you customised the file upload location (or explicitly specify the file upload location)?
If your answer is yes to the above questions, then what I have in this post might be the answer that you are looking for.
The key here is, you’ve explicitly specified a file upload location (which can be your wp-content/uploads
but with an explicit, full path). You can confirm that by checking your wp-config.php
file, where you should see something like
define('WP_TEMP_DIR', dirname(FILE) . '/wp-content/uploads');
or
define('UPLOADS', dirname(FILE) . '/wp-content/uploads');
What it means is, set my upload directory to the full path of the base directory of my wordpress site, e.g. /home/mywebsite/www
, and append /wp-content/uploads
to it, therefore, it will save your upload folder path to an absolute path of /home/mywebsite/www/wp-content/uploads
instead of a relative path.
If that’s what you have done, or if you can see “Store uploads in folder” option under Settings -> Media, then what you’ll need to do to fix this issue is:
Option 1:
- Login as admin to your wordpress site, i.e. something like https://mywebsite.com/wp-admin
- Go to Settings -> Media (usually on the left hand side panel)
- Update the path to a correct path based on your new host settings (you can set it to
wp-content/uploads
to make it a relative path)
Option 2:
- ssh to your web host or access your list of files from your hosting provider (e.g. cPanel file explorer)
- Edit file
<base directory of your wordpress site>/wp-config.php
- Update the custom config where application
WP_TEMP_DIR
and/orUPLOADS
as shown above - Save the file
Then try to upload your files again.