You may face this error because of few reasons:
- Issue with directory ownership / permissions or
- Location of the uploads folder is not correct in wp-config.php / wp-admin settings
Check Directory Permissions using FTP client or File Manager in cPanel:
1. Connect to your cpanel account via an FTP client or open file manager in cPanel .
2. Open WordPress installation directory, It is usually public_html/ in cPanel .
3. Explore to the wp-content/uploads folder .
4. In FTP client click on File Permissions and make sure to folder permissions are set to 755 .
5. Please make sure to select Recurse permissions option to apply permissions on sub directories .
6. Click on Apply button to apply permissions on directories .
Check file/ folder ownership and folder permissions using SSH client/ Terminal:
1. Logon to your server/ VPS through SSH client/ Terminal
2. Change Directory to wp-content
cd /home/{user}/wp-content/
** replace {user} with the name of cpanel user
3. type below command to check folder permissions:
ls -lah
4. change folder ownership :
chown -R {user}:{user} uploads
** replace {user} with the name of cpanel user
5. You can also change folder permissions from SSH/ terminal following command below:
chmod 755 -R uploads
** Note need to have Terminal access/ ssh permissions to logon to your server for cPanal account
Change Upload folder Directory through wp-config.php
1. Access your cPanel/ Plesk File Manager or through FTP client wp-config.php file.
2. add below code in wp-config.php before this line >> require_once(ABSPATH . ‘wp-settings.php’);
define( ‘UPLOADS’, ‘wp-content/uploads’ );
3. Save File
Change upload folder directory through wp-admin interface
1. Log in to your WordPress admin panel (** https://your-website.com/wp-admin/) .
2. In the left menu explore Settings >> Media
3. In the Store uploads in this folder field, enter wp-content/uploads and click Save changes .
4. make sure that the Store uploads in this folder field contains wp-content/uploads or full path to folder path .
Please replace https://your-website.com/ with domain URL of your website .