Knowledge to Power Your Website

How to Fix the “Upload: Failed to Write File to Disk” Error in WordPress (3 Ways)

How to Fix the “Upload: Failed to Write File to Disk” Error in WordPress (3 Ways) thumbnail

Are you encountering the “Upload: Failed to write file to disk” error message when uploading files in WordPress? Whether you’re trying to add images or videos to your site, this message can be very frustrating, as it prevents you from sharing your amazing visuals with your audience.

Fortunately, you can troubleshoot this issue by following a few simple steps. In some cases, you’ll just need to contact your web host to get it fixed.

In this post, we’ll take a closer look at the “Upload: Failed to write file to disk” error and its main causes. We’ll then show you three simple ways to fix this problem. Let’s get started!

What Causes the “Upload: Failed to Write File to Disk” Error in WordPress

The “Upload: Failed to Write File to Disk” error message typically comes up when you’re trying to upload media files to your WordPress site. There are a few possible causes, the most common one being incorrect file permissions.

Every file and folder on your WordPress site comes with a set of permissions. These are controlled by the web server and determine which site users can access and edit your files and folders. Thus, if the permissions are incorrect, you may be unable to perform certain actions on your site, such as uploading images to your media library.

However, this error could also be caused by other issues, including a full WordPress temporary folder. It’s also possible that you’ve reached the disk space limit provided with your hosting plan.

Next, we’ll take a closer look at these possible causes. We’ll also walk you through a solution for each scenario.

Skip the Stress

Avoid troubleshooting when you sign up for DreamPress. Our friendly WordPress experts are available 24/7 to help solve website problems — big or small.

How to Fix the “Upload: Failed to Write File to Disk” Error in WordPress (3 Ways)

Now, let’s look at three easy ways to fix this disk error in WordPress. As always, we recommend that you perform a backup of your site before proceeding. That way, if something goes wrong, you can restore your site to an earlier version.

1. Change the File Permissions

As we mentioned earlier, the “Upload: Failed to write file to disk” error is likely caused by incorrect file permissions. If you want to check these permissions, you can contact your hosting provider and ask them if they can do it for you. Alternatively, you can do this yourself by accessing your site’s root directory.

First, you’ll need to connect to your site via a Secure File Transfer Protocol (SFTP) client such as FileZilla. You can also access your site’s directory through the file manager in your hosting account.

If you have a DreamHost account, start by navigating to Websites > Files in the sidebar. Then locate your domain and click on the Manage Files button.

Accessing your site in DreamHost

This will take you to the file manager. To access your site’s directory, you can open the folder labeled with your domain name. Inside, locate the wp-content folder and right-click on it.

Next, select File permissions.

Locating the wp-content folder in your site’s root directory.

In the pop-up window, go to the Numeric value field and enter “755” or “750” in the corresponding box. Next, you can select the Recurse into subdirectories and Apply to directories only options and click on OK.

Changing the file permissions of your subdirectories in FileZilla.

You have now set the correct file permissions for all subdirectories inside the wp-content folder. This includes the uploads folder, which is where your uploaded media files are stored.

However, you’ll also need to set the correct permissions for the files within those folders. To do this, you can right-click on the wp-content folder again and select File permissions.

In the Numeric value field, type in “644”. Then select the Recurse into subdirectories and Apply to files only options, and click on OK.

Changing the file permissions of your files in FileZilla.

Don’t worry if you’re still unable to upload files to your site after checking your file permissions. There are a couple of other things you can do to resolve the issue.

2. Empty the WordPress Temporary Folder

If changing the file permissions doesn’t solve the problem, you may need to empty your temporary folder. WordPress processes your media uploads in PHP. This means that your images are first saved in a temporary folder on your web server before being transferred to your uploads folder.

If the temporary folder is full, WordPress won’t be able to write your files to disk until you’ve emptied it. Unfortunately, you cannot access this temporary directory via SFTP.  However, you can simply contact your hosting provider and ask them to empty the folder for you, and then check to see if the error has been resolved. If you have sudo users, you could ask them to clear your temporary folder.

Alternatively, you can try to resolve this issue by defining a new location for WordPress to store your media (instead of the temporary folder). First, you’ll need to connect to your site via an SFTP client or the file manager. Then locate the wp-config.php file, right-click on it, and select View/Edit.

Editing the wp-config.php file in FileZilla.

Next, you’ll need to paste in the following code right before the line that reads “That’s all, stop editing! Happy publishing”:

define(‘WP_TEMP_DIR’, dirname(__FILE__) . ‘/wp-content/temp/’);

Save your changes, then navigate to the wp-content folder, open it, and create a new folder inside it called temp.

Creating a temp folder inside the wp-content folder.

When you’re done, you can return to your website and try to upload an image. If the file disk error was caused by the temporary folder, the issue should now be resolved.

3. Upgrade Your Hosting Plan

The disk error could also be a sign that you’ve outgrown your current hosting plan. For example, if you’ve been adding a lot of content to your site, including media files, new pages, and plugins, you might have used up all the disk space available in your account.

Your web host may be able to tell you how much disk space you have left. If you’re a DreamHost client, you can check your disk usage by logging into your hosting account and navigating to Billing & Account > Disk Usage in the side menu.

Checking your disk usage in your DreamHost account.

If you’ve reached your disk space limit, you might need to upgrade to a more advanced hosting plan. This will give your site more room to grow. We recommend getting in touch with your hosting provider to discuss the possibility of switching to a higher plan.

Additional WordPress Error Articles

Do you want to learn how to resolve other technical issues on your site? We’ve put together several tutorials to help you troubleshoot the most common WordPress errors:

If you’re looking for more information about running a WordPress site, make sure to check out our WordPress Tutorials. This is a collection of guides designed to help you navigate the WordPress dashboard like an expert.

Take Your WordPress Website to the Next Level

Whether you need help navigating file permission issues, choosing a web hosting provider, or finding the best plugin, we can help! Subscribe to our monthly digest so you never miss an article.

Fix the “Upload: Failed to Write File to Disk” Error

The “Upload: Failed to write file to disk” error message prevents you from uploading files such as images and videos to your WordPress site. Incorrect file permissions on your site normally cause this error. However, you may also be seeing this message because you’ve used all the disk space offered with your hosting plan.

In this article, we looked at three simple ways to fix this common WordPress error:

  1. Change the file permissions of your WordPress site using an SFTP client like FileZilla.
  2. Empty the WordPress temporary folder by getting in touch with your web host.
  3. Upgrade your hosting plan to access more disk space.

At DreamHost, we provide 24/7 expert support to help you efficiently resolve technical issues. We also offer reliable managed WordPress hosting solutions to help you grow your business while also making it easy for you to upgrade to an advanced plan as your site grows.

About the Author:

A long-time WordPress user, Megan has wielded a red pen (and keyboard) at DreamHost since 2017. Her passion: helping others turn great ideas into thriving websites. Her arsenal includes insightful guides, in-depth tutorials, and the occasional pun.