This error occurs when the “upload_path” value in the WordPress options table isn’t valid.
You can update this to the correct path with this SQL query:
UPDATE wp_options SET option_value = ‘/home/correctpath/public_html/wp-content/uploads’ WHERE option_name = ‘upload_path’ LIMIT 1;
You may need to change the table name, wp_options, depending on your table prefix.