WordPress cannot create an upload directory: checking paths and permissions
When WordPress cannot create a directory during a media upload, first distinguish an incorrect destination from an unwritable one. A stale path after migration is worth checking, but the error alone does not identify the cause.
What the error tells you
A common message is:
Unable to Create Directory wp-content/uploads. Is its Parent Directory Writable by the Server.
The server failed to create an upload directory. Clearing a browser cache or switching browsers cannot repair a server-side path, ownership, or mount problem.
Check whether the site was recently migrated, the PHP service user changed, or the media location was customized. Record the current configuration and back up the database before changing stored options.
Inspect the path WordPress actually uses
If WP-CLI is installed, run these checks as the site's maintenance user from the correct WordPress installation directory:
wp option get upload_path
wp eval 'print_r(wp_upload_dir(null, false));'
The first command reads the historical upload-path option. The second displays WordPress's calculated directories and URLs. Passing false as the second argument to wp_upload_dir() prevents this check from attempting directory creation, so its error value is not a write-permission test.
Compare basedir and path with the actual media directory. An old hosting username or nonexistent absolute path is a reason to inspect upload_path, the UPLOADS constant in wp-config.php, and plugins that change upload locations. On multisite, select the correct site, for example with WP-CLI's --url argument. Path calculation reference; reading options with WP-CLI.
Correct a stale path without overriding valid configuration
By default, an empty upload_path makes WordPress use WP_CONTENT_DIR/uploads. A UPLOADS constant or plugin may intentionally select another location.
Only after confirming a standard single-site installation, an obsolete upload_path, and media actually located in the default directory should you clear the legacy value, after taking a backup:
wp option update upload_path ''
Inspect the calculated path again. This changes configuration; it neither moves old files nor replaces image URLs inside posts. Plan any file migration separately. Do not add duplicate UPLOADS definitions or override an active custom media setup just to suppress an error. Option update command.
Older tutorials changed the path through a field under Settings → Media. That field is not displayed in every version, and its absence is not itself another fault.
Check permissions and storage when the path is correct
The PHP process serving requests needs access to write in the upload directory. Successful writes through SSH or FTP do not establish that PHP can write there. Check:
- Ownership, group, and permissions on the upload directory and its parents.
- Whether the PHP user can traverse the parent directories and create files and subdirectories at the destination.
- Writable container mounts, available disk space, and account quotas.
- Additional controls such as ACLs or SELinux if ordinary permissions appear correct.
Directory mode 755 and file mode 644 work only with suitable ownership and access arrangements; they are not universal repair commands. Correct the relevant user/group access and upload location instead of making the entire site 777. WordPress file-permission documentation.
Verify the result
Upload a test image and confirm that its file and thumbnails appear in the intended directory and work in both the media library and the public page. Check old images too, so a successful new upload does not conceal missing migrated files. If the upload still fails, inspect PHP logs and the actual path rather than repeatedly broadening permissions across the site.
Published 08/21/2018 · Krunk Zhou
Join the conversation