WordPress Error: Destination directory for file does not exist or is not writable

How to fix Download failed.: Destination directory for file streaming does not exist or is not writable

Have you ever tried to update a plugin or theme on your WordPress website and you’re greeted with this error message: “Update failed Download failed- Destination directory for file streaming does not exist or is not writable?” 

 

If you have been using WordPress for quite a while I’m sure you must have come across this error message, because it’s one of the most common errors in WordPress. The question is, what causes this error and how can we fix it? I will answer these question in this post, showing you a step by step guide on how to locate the source of the error and fix it.

 

So, let’s get started right away.

 

What Causes the Error?

Before you can make a theme or plugin update to your WordPress website, WordPress needs a temporary folder/path where it will extract the theme or plugin files before installing and activating on your website. This error happens when the temporary folder/path does not exist or WordPress is not able to find the path to it. It could be because of permission error or simply because there is the wrong path mentioned.

 

This error is commonly experienced if you have had a WordPress installation on localhost, e.g. Bitnami (XAMPP), before moving your website to a live server. In my case, this was exactly the reason. I designed my website on local host using XAMPP. After moving it to live server, I could not update any of the plugins and themes. I tried everything possible but I keep getting the error: “Update failed Download failed- Destination directory for file streaming does not exist or is not writable”

 

You may also experience this error if you’re using Google Cloud and then when you move your website to a different shared hosting or managed hosting. You may also experience the error because of wrong file permission setting.

 

Like I stated earlier, my problem is not related to permission setting but I will show you both solutions. And for you to be able to solve the problem, you will need to get access to the File Manager folder of your website in your cPanel (for those using cPanel hosting accounts). There are two ways you can access the File Manager. If you’re using cPanel you can just follow the same tutorial, but in case you are not using cPanel or your hosting provider does not provide cPanel you will have to get access to the File Manager using FTP.

 

If you don’t know how to use FTP, you can read How to Connect Your cPanel with FTP Client.

 

In this article however, I’m going to demonstrate the solution to this problem using cPanel. To access the File Manager on the cPanel, login to your hosting account and navigate to cPanel. You should see something like the image below.

Screenshot of cPanel

 

The File Manager is the first folder as can be seen on the screenshot above. Click on it and it will take you to a list of all the files on your website. As can be seen in the screenshot below, there are two public-html indicated in red and green colors. If you have just one website on your server, then you can click the one indicated in green color to access the file we are going to edit.

public-html

 

In my own case, I have more than one websites so I’m going to click on the one indicated in red color. The file I’m going to edit is the wp-config.php, as shown in the screenshot below. The website’s file I’m going to edit is the main website hosted on this server, so I will just locate the wp-config.php in the root directory.

 

WP-config

 

The file to edit is indicated in red box above. We need to open it and edit it in order to fix the error. Here the permission is set to 0644. Some situations may require you to change the permission. But for this particular error, let’s edit the file by changing a single line of code within the file. If that doesn’t fix the error, another thing we can do is to change the file permission.

 

It is a recommended practice to backup any file on your website before you make any changes. Click the file and look towards the left hand corner of the page, you should see a “Download link”. Click on it and download it to your drive.

 

How to backup and edit wp-config.php
How to backup and edit wp-config.php

To open the file, click on it and look towards the top right hand corner of the page, you should see an option “Edit” (You can use the screenshot above as a guide). Click on it to open the file. A warning will pop up telling you to backup the file. Since you have done that already, ignore the warning and click on “Edit” on the dialog box that pop up. That should open the file in a new tab.

 

Once the file is open, type Ctrl + F (Ctrl + F is used to search for something in a file. If you are on a Mac Operating System, it should be Cmd + F). A box will pop up once you type Ctrl + F on your keyboard, as shown in the image below. Inside the box, type temp.

 

Searching for code to replace in wp-config.php
Searching for code to replace in wp-config.php

 

Once you type temp in the box you should see a line of code as indicated in the image below.

 

Editing wp-config.php

 

As you can see from the screenshot above, the defined directory –define(‘WP_TEMP_DIR’, ‘C:/xampp/apps/wordpress/tmp); is still pointing to XAMPP installation of WordPress on my local drive. Of course this no longer exist since the website is not on live server. That’s exactly why you got the error notice: “Download failed.: Destination directory for file streaming does not exist or is not writable.”

 

In my own case, since the error is due to the fact that I created the website on a local drive using XAMPP before migrating to live server, what I need to do is to delete this line of code and save the wp-config.php file. That’s enough to solve the problem. But since you own might not be the same, I will give several ways you can solve this error in this article.

 

You can solve the error by defining a correct path. So you if you’re also getting the same error and you didn’t create your site using XAMP, you may be able to fix it by defining the following directory: define(‘WP_TEMP_DIR’, ABSPATH . ‘/../temp/’); i.e. you replace the directory define(‘WP_TEMP_DIR’, ‘C:/xampp/apps/wordpress/tmp); with define(‘WP_TEMP_DIR’, ABSPATH . ‘/../temp/’); and save the wp-config.php file. Close the file, go back to your WordPress dashboard and try updating our updating a plugin, theme or the core WordPress itself.

 

If that does not solve the problem try the second option below.

 

Delete that entire line of code and save the wp-config.php file. Go back to you dashboard and try updating a theme, plugin or core WordPress. As stated earlier, this worked in my own case.

 

You might have to try all of the methods described here to see which one works for you. Once you have been able to resolve the issue and you update a plugin or theme successfully, you should also try to install a new theme or plugin to make sure that everything is working properly.

 

If the above methods do not work for you the last option is to change the file permission of the folder named wp-content (indicated in the screenshot below).

how to edit the wp-content folder to solve WordPress error

 

Normally, for most hosting providers, i.e. about 95% of hosting providers, the correct file permission for this folder will be set at 0755. This permission setting allows you to write any content to that folder. But for some hosting provider, you may have to set it to 777. However, this is not recommended as it is a bad security practice.

 

So what you are to do here is to change the folder permission to 777, try making an update to your theme/plugin/core WordPress. If it works, then revert the file permission to what it was before.

 

And that’s it for fixing the WordPress error: “Update failed Download failed- Destination directory for file streaming does not exist or is not writable?” I want to believe you found this tutorial helpful and your problem is solved now. Do let me know in the comments section if this worked for you or not and/or if you have a different method of fixing this error.

Facebook
Twitter
LinkedIn
Telegram
WhatsApp
Email
Print

Related Posts

Hostinger

Hostinger Review

You probably have considered developing/building a website at some point in your life. If so, then you might have looked into different web hosting services.

Read More »

Leave a comment

Your email address will not be published. Required fields are marked *