Unable to create directory uploads/2021/07.
I was trying to upload some new images but got the above error message. I checked the directory permissions and they were fine. I then manually created the directory and still got the same error message.
Tracking down the root cause
My hosting provider, Siteground provide a log file called php_errorlog in the sites root directory. Looking at this I could see that it was also reporting that the directory could not be created. However looking carefully at the message the path to the directory wasn’t right.
I think Siteground whilst migrating the site from CPanel to their new SiteTools had failed to update one of the settings.
Fixing the Unable to create directory uploads/2021/07
I added the following line into the wp-config.php file
define( ‘UPLOADS’, ‘wp-content/uploads’ );
And, just like that, the problem was fixed and uploads started working again.