This is a very common error, you will encounter in the wordpress. When we try to upload any media file from the wordpress admin, You will get this error if your webserver doesn’t have permission to create folder or file.

Solution: Run the below command and it will fix the issue.

chown -R www-data:www-data /var/www/html/wp-content/uploads

“/var/www/html/wp-content/uploads”, Kindly replace the uploads folder path with your server path.