6
votes

I have a wordpress installed . Host provider is 1&1. Now if i tried to upload media file it show me the error missing a temporary folder . I also define a path fpr temp directory . I refer this link link . And created the php.ini file in the home directory . My php.ini file content is

upload_max_filesize = 16M
upload_tmp_dir = on
upload_tmp_dir = /epigram.co.uk/tmp

I also tried to change wp-config file and added this

define('WP_TEMP_DIR','/epigram.co.uk/tmp');

Also tried with full path . like

define('WP_TEMP_DIR',$_SERVER['DOCUMENT_ROOT'].'/tmp');

Nothing helped me . any help will be appreciated .Thanks

6
That error is thrown by PHP and likely you will need to contact your host to have them specify a temporary directory (e.g. upload_tmp_dir in php.ini)Deep Kakkar
there is allready a php.ini file on my wordpress root folder. Can't i set this from here??Manoj Dhiman
just posted a answer with the steps, please checkDeep Kakkar

6 Answers

3
votes

Edit your php.ini file which is located in etc/ folder, remove comment from the line upload_tmp_dir (by deleting the semi-colon “;”) and pointing the variable to a folder using an absolute path.

1.) open a terminal

2.) create a temporary folder for all apache tasks in your user folder and grant all right to all users:

mkdir wwwtmp && chmod 0777 wwwtmp

3.) edit php.ini with your text editor and set the temporary folder (you must switch to root user)

 su
 vim /opt/lampp/etc/php.ini
 upload_tmp_dir = /home/my_user/wwwtmp/

Remeber to remove preceding “;”

4.) save the file (in vim type :wq an press enter) and restart xampp using this command

/opt/lampp/./lampp restart

I hope this will remove error if everything went fine.

2
votes

Problem : WordPress is giving error on image upload : "image.jpg" has failed to upload due to an error "Missing a temporary folder."

If you are receiving this error please follow these simple instructions below:

  1. Create a "tmp" folder in your WordPress root directory with 777 permissions. This can be done by your FTP program.

  2. Also create a "php.ini" file in same location.

  3. Add the following in php.ini file:

    upload_max_filesize = 16M

    upload_tmp_dir = on

    upload_tmp_dir = /home/username/public_html/wordpressDir/tmp

Please make sure to replace username with your hosting username, and wordpressDir with the directory name of your WordPress install. If you have installed WordPress on your homepage then the path will be like: upload_tmp_dir = /home/username/public_html/tmp

  1. Copy the same php.ini file to your wp_admin folder.

That's it.

2
votes

My server is a shared one powerd by plesk. I just changed the PHP vesion from 7.something to 5.something, and the problem was solved! I can upload images to the wordpress media galery

0
votes

On Linux at aws. The below worked for me

chmod -R 775 /tmp
0
votes

This error can happen if you are using IIS server and a fastCGI module with Thread-safe version of Php. As the Php download page states:

IIS If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.

Hope this helps someone.

-1
votes

Add From Server plugin saved my time. it's easy to use, just upload your image through ftp and use Add from sever plugin to import to your Media Library.