WordPress upload errors are easier to solve when you first identify which stage failed. A message such as “missing temporary folder,” “failed to write file to disk,” “file type is not permitted,” or a generic media upload failure does not point to the same cause. Some failures happen in PHP before WordPress receives the file, some happen while WordPress validates the MIME type, and others happen when the server tries to move the file into the uploads directory.
This guide groups the most common WordPress upload and file errors by the layer that causes them. Use it as a diagnostic map instead of changing permissions, PHP limits, and plugins all at once.
Quick diagnosis
- “Missing a temporary folder”: check PHP’s temporary upload directory and whether WordPress can find a writable temp location.
- “Failed to write file to disk”: check server storage, the PHP upload path, filesystem health, ownership, and permissions.
- “File type is not permitted”: verify the file extension, MIME type, WordPress allowed-upload rules, and whether a security plugin changes those rules.
- HTTP or generic image upload error: check file size, PHP upload limits, image processing, storage, security layers, and server logs.
- “Failed to open stream”: read the full path in the error. It usually identifies the missing, unreadable, or unwritable file.
Start with the exact error and the failing stage
Do not begin by setting every folder to 777 or by disabling every plugin. First reproduce the error once and record the full message, the file type and size, and whether the same problem occurs with a small JPG or PNG.
A useful upload path looks like this:
Browser → PHP temporary file → WordPress validation → uploads directory → image processing → Media Library
The error message usually tells you where that chain broke. For example, WordPress core receives the PHP upload error code and uses the file’s temporary path, size, MIME type, and extension during validation. If PHP cannot provide a usable temporary file, WordPress cannot repair that problem by changing a Media Library setting.
Temporary-folder errors are usually a PHP or hosting problem
WordPress has a function that looks for a writable temporary directory. It prefers the system temporary directory, then PHP’s upload_tmp_dir, then WordPress content storage, before falling back to other options. WordPress also supports overriding the temp path with WP_TEMP_DIR when appropriate.
If you see “Missing a temporary folder”, check:
- whether PHP’s
upload_tmp_dirpoints to a real directory, - whether that directory exists and is writable by the PHP/web-server user,
- whether hosting restrictions such as
open_basedirblock access, - whether the hosting platform recently changed PHP configuration,
- and whether a custom
WP_TEMP_DIRvalue points to a valid writable path.
Creating random tmp or temp folders inside WordPress is not a reliable fix by itself. If PHP reports that no upload temp directory is available, the hosting configuration should be checked first.
“Failed to write file to disk” points to storage or filesystem handling
This message means the upload reached PHP but could not be written successfully to storage. Check the server before changing WordPress content.
Review:
- available disk space and account quota,
- inode or file-count limits on shared hosting,
- the temporary upload directory,
- filesystem ownership,
- permissions on the WordPress uploads path,
- read-only filesystem conditions,
- and hosting error logs around the time of the failed upload.
On many Linux WordPress hosts, directories commonly use 755 and files commonly use 644, but correct ownership is just as important as the numeric permission value. Do not recursively set the whole site to 777. If WordPress cannot write files that previously worked, ask the host whether ownership or the PHP/web-server user changed.
File-type errors are MIME-validation errors, not disk errors
WordPress ships with a list of allowed upload file types and checks the uploaded file’s extension and MIME type. If the type is not allowed for the current user, WordPress can reject it with a message such as “Sorry, you are not allowed to upload this file type.”
Before adding custom code to allow a file type, check:
- that the extension matches the actual file contents,
- that the file is not renamed from another format,
- that the type is intended to be uploaded to WordPress,
- that a security plugin is not removing the MIME type,
- and, on Multisite, that the network upload rules allow that extension.
Allowing executable or risky file types only to bypass an error can create a security problem. If the file is a normal document, image, font, or media type that your site genuinely needs, use the narrowest supported MIME rule rather than disabling upload validation globally.
Generic image-upload failures need a smaller test file first
If WordPress only says an image could not be processed or the upload fails without a precise message, test with a small, ordinary JPG or PNG. That separates a general upload problem from one caused by a specific image.
If the small file works, investigate:
- image dimensions,
- file size,
- PHP
upload_max_filesize, - PHP
post_max_size, - server memory available for image processing,
- ImageMagick or GD failures,
- and image-optimization plugins.
If even a tiny JPG fails, focus on the temp directory, storage, permissions, security rules, and server logs rather than image dimensions.
“Failed to open stream” requires reading the path in the error
A failed-to-open-stream error can be caused by a missing file, incorrect path, permission problem, or a process that cannot read or write the target. The most useful clue is usually the path and the text after failed to open stream.
Examples of what the message can tell you:
- No such file or directory: the path or file does not exist where PHP expects it.
- Permission denied: ownership or permissions prevent access.
- Operation failed: review the surrounding plugin, theme, server, or filesystem context.
Do not replace WordPress core files simply because the message contains a WordPress path. First identify which component called the file and whether the path itself is valid.
When the Media Library is blank but files still upload
A blank Media Library grid is often a different problem from an upload failure. If files upload successfully but thumbnails do not appear in the dashboard, check browser JavaScript errors, REST API or AJAX requests, caching, media-related plugins, and theme/admin conflicts.
That is why a Media Library display problem should not automatically be treated as a permissions or storage error. First confirm whether the file exists in wp-content/uploads and whether WordPress created the attachment record.
Safe troubleshooting order
- Record the exact error message and file type.
- Retry with a small JPG or PNG.
- Check free disk space and hosting file limits.
- Check PHP temp-folder and upload-limit settings.
- Check the WordPress uploads directory and ownership.
- Review browser Network errors and server/PHP logs.
- Temporarily test recently changed media, security, and optimization plugins.
- Ask the host to verify PHP and filesystem configuration if the failure happens before WordPress can process the file.
What not to do
- Do not set the entire WordPress installation to 777.
- Do not enable arbitrary executable MIME types just to bypass an upload error.
- Do not increase every PHP limit without checking which limit is actually reached.
- Do not delete the Media Library database records when the real problem is a server temp directory.
- Do not assume every upload error is caused by a plugin.
Official references
- WordPress Developer Reference: get_temp_dir()
- WordPress Developer Reference: _wp_handle_upload()
- WordPress Developer Reference: check_upload_mimes()
Bottom line: WordPress upload errors are not one problem. Identify whether the failure happens in PHP temporary storage, MIME validation, filesystem writing, image processing, or Media Library display. Fix the responsible layer first and avoid broad permission or security changes that are unrelated to the actual error.