filesystem - Uploading Media gives error "Missing a temporary folder."

admin2025-06-05  0

After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.

"Missing a temporary folder"

Various articles around the web mention the php setting upload_tmp_dir needing to be set in php.ini. This is not actually a requirement. I know because it is not set in our test environment, and it was not set in our production environment before the deploy. In both cases uploads worked.

So what changed?

I have an answer, but I'm not sure it's the definitive answer. I'll post mine.

After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.

"Missing a temporary folder"

Various articles around the web mention the php setting upload_tmp_dir needing to be set in php.ini. This is not actually a requirement. I know because it is not set in our test environment, and it was not set in our production environment before the deploy. In both cases uploads worked.

So what changed?

I have an answer, but I'm not sure it's the definitive answer. I'll post mine.

Share Improve this question asked Oct 29, 2010 at 18:15 leffleff 1511 silver badge4 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 2

upload_tmp_dir is an optional setting in php.ini. Php will attempt to use the system default temp directory. So it should just work.

If something happens to the permissions on your temp directory, regardless of wether you set it in php.ini or use the system default (usually /tmp on unix like systems), then media uploads will fail. You will see the same error "Missing a temporary folder" if folder doesn't exist, but also if you don't have proper permissions on the temporary directory.

Your web server, Apache or whatever, is probably running as nobody, or some other account with basically no rights to anything. So the first thing to check is that /tmp is globally writable.

On unix like systems it goes something like this. I'm assuming that your system default temp directory is /tmp. From the command line

$ ls -l /tmp
lrwxrwxrwx@ 1 root  admin  11 Sep 10 11:40 /tmp

The first bit lrwxrwxrwx should look just like that. No dashes. If not

$ chmod 777 /tmp

and if it gives you permissions errors

$ sudo chmod 777 /tmp

You'll need the root password.

I am answering to this old question, as a lot of people are facing the same issue in 2018. You can fix the missing temporary folder error using cPanel. Follow these steps: Head to cpanel.

  1. Click on File Manager.
  2. Click on public_html in the left-hand sidebar.
  3. Find wp-config.php file. Right-click on it and choose Edit.
  4. A pop up will appear. Click on the Edit button.
  5. A new tab will be opened. Add the following line:

    define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');
    
  6. Now, go to the previous tab of file manager. Open the wp-content directory.
  7. Create a new folder by clicking on +Folder in the cPanel navigation menu.
  8. A pop up will appear. Add temp in the box below New Folder Name.
  9. Click on the Create New Folder button.
  10. Refresh the page to see the new folder.

Now, you will find that the missing temporary folder issue is gone. You can find more information about these steps right here.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749058264a315998.html

最新回复(0)