Missing a temporary folder not fixed

I uploaded my first wordpress website on the server, but trying to add new media files, i have got the message Missing a temporary folder, I tried the solutions on the forum:

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

and created a 'temp' folder on 'wp-content', but the problem still happened .. how to fix that please ??

I tried by doing this : creating the folder on localhost with writable property then upload it to the server, but it still doesn't work

Topic uploads media Wordpress

Category Web


I have accidentally deleted the tmp folder from my computer (Macbook) and faced the issue on the localhost WordPress site, and followed the below steps to fix the issue:

  1. First, have to check the temporary folder location by the below code.

    var_dump(sys_get_temp_dir()); In my case, the output was /var/tmp

  2. Then, we have to check if the folder exists or not, by the below code. var_dump(file_exists(sys_get_temp_dir())); In my case, the folder did not exist as I already deleted that.

  3. If the folder does not exist, then create a new folder named tmp. Open the terminal and navigate to the folder /private/var and create a new folder named tmp.

  4. If the issue is not fixed yet, or the folder already exists then we have to check the permissions of the folder.


  1. You need to add that line to your wp-config.php. Double check that you put it in the right place.
  2. You need to set the permissions on that directory you created so that Wordpress can write to it. This is dependent on how your hosting works and what program you're using, but you should try setting the permissions to e.g. 770, which gives write permission to both the user and group.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.