• I worked in my blog last week, and today I wanted to upload an image and I get the “missing temporary folder” error.

    I’ve already added the following line to the wp-config.php file:
    define(‘WP_TEMP_DIR’, dirname(__FILE__) . ‘/wp-content/temp/’);

    I’ve also added a “temp” folder to the /wp-content/ folder and changed permissions as recommended in https://www.wpbeginner.com/beginners-guide/how-to-fix-file-and-folder-permissions-error-in-wordpress/

    But I’m still getting the “missing a temporary folder” error!!!

    My blog is https://centroespigas.edu.uy/blog

    I use the following plugins:
    – Polylang
    – Google Analytics para WordPress por MonsterInsights
    – UpdraftPlus

    I would really appreciate if any of you can help me!

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator t-p

    (@t-p)

    Thread Starter made2105

    (@made2105)

    Thanks t-p. But I already did everything explained in that tutorial.
    but I keep getting the message and cannot upload any images.

    Thread Starter made2105

    (@made2105)

    Does anyone have other solution from what I already did and posted in the OP?

    Thread Starter made2105

    (@made2105)

    Finally I figured out what was happening. I’m leaving this comment in case it helps someone else.
    Apart from following the instructions here
    https://www.wpbeginner.com/wp-tutorials/how-to-fix-missing-a-temporary-folder-error-in-wordpress/

    you have to define the “temp” file in your php.ini file, usually located in your host provider settings.

    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ; https://php.net/upload-tmp-dir
    upload_tmp_dir = /home/users/web/xxx/wp-content/temp

    Hi made2105,

    I have the same issue and wanted to try out the “defining of the “temp” file in your php.ini file”. I haven’t rewritten the php.ini file yet, could you please share your exact steps of how to rewrite it? That would be awesome!

    Cheers,
    Johannes

    Thread Starter made2105

    (@made2105)

    Hi Johannes,

    First you have to follow the instructions in https://www.wpbeginner.com/wp-tutorials/how-to-fix-missing-a-temporary-folder-error-in-wordpress/

    After that, search for the php.ini file which is located in your hosting settings in your control panel. I suppose it would depend on which hosting server you’re using.

    This is the part I was talking about and what I currently have written there:

    ;;;;;;;;;;;;;;;;
    ; File Uploads ;
    ;;;;;;;;;;;;;;;;

    ; Whether to allow HTTP file uploads.
    ; https://php.net/file-uploads
    file_uploads = On

    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ; https://php.net/upload-tmp-dir
    upload_tmp_dir = /home/users/web/xxx/xxx/xxx/xxx/wp-content/temp

    The xxx correspond to the folders were the blog or wordpress is located.

    Hope this helps. If not, you might have to ask for assistance with your hosting provider.

    Good luck!

    Here is a more comprehensive take on how to fix "Missing a temporary folder".

    Add echo ini_get("upload_tmp_dir"); somewhere to your code. It will print the path to that temporary folder that is supposedly missing. Check that the folder exists and is writable.

    • If it doesn’t exist, then create it.
    • If it exists but is not writable, try to make it writable.
    • If you can’t create it / make it writable, try to change it to a folder that you can create & make writable using one of the approaches above (via define("WP_TEMP_DIR", "..."), php.ini or doing directly ini_set("upload_tmp_dir", "...")).
    • If all of above fails (and it’s not unlikely that you won’t be allowed to change PHP configuration in many environments), you need to reach out to your hosting provider.

    A bit more context:

    The way file upload works in PHP apps is that when the user uploads a file, it is stored to a temporary directory by “the server” and the server then simply passes the path of this temporary file to the PHP app (= WordPress in this case). The app can then take the file and move it to the target location (e.g. wp-uploads).

    If the temporary directory for some reason doesn’t exist, the server indicates that to the PHP app as UPLOAD_ERR_NO_TMP_DIR which in this case WordPress converts into the infamous “Missing a temporary folder”.

    What’s important is that this mechanism is completely independent on WordPress!. The temporary directory is configured via upload_tmp_dir PHP ini config variable, i.e., it’s part of your server / PHP configuration. If it’s broken, it’s likely that you won’t be able to fix it yourself. You may try to override upload_tmp_dir but that’s very often not possible.

    However, as this is part of the server configuration set up by your provider, it shouldn’t be broken all that often. What’s possible, though, is that somebody (most likely you) messed with the temporary folder, so even though the config is correct, the folder is not (in my case, I accidentally deleted it). So the first step for you is to check what the temp directory is and whether it exists and is writable.

    Now regarding WP_TEMP_DIR: This seems to have helped a lot of people, judging from the search results. TBH, given what I wrote above, I have no idea why WP_TEMP_DIR should be relevant for file uploads. It’s possible that WordPress does additional postprocessing (resizing images…) for which it needs its own temporary folder.

    In my case it was the ‘Inodes’ (see the meaning here). The Inodes you can find in your CPanel Statistics. Mine was over 100%, hence the error.

    To reduce your number of inodes you may want to see all these solutions proposed in this article: https://www.socmedsean.com/solved-how-do-i-reduce-my-inode-usage-on-siteground-hostgator-or-other-hosts/

    Summary:
    – Remove Unused Themes
    – Remove Old Plugins That Aren’t Needed Or Are Deactivated
    – Remove Overly-Complex Folder Structures
    – Remove Obsolete WordPress Core Files
    – Reduce The Number Of Images You Have Stored On Your Server
    – Delete Old Backup Files
    – Remove Unnecessary Cache Files
    – Work With Your Host To Remove Folders In The /tmp Or /temp Folders That You Might Not Have Access To

    Friends, I am having this issue after moving to php7.4. I have set the values in wp-config as well as my php.ini file. I can see that I have a upload_tmp_dir set correctly by printing phpinfo. I’ve played with permissions. Has anyone come across anything else that helped? Thanks!

    I think I got it. I ended up having to put a php.ini file specifying the temp dir in wp-admin in addition to the root wp directory.

    I had this error happen and the problem was an old theme. I temporarily switched theme to one of the default WordPress themes (‘twentytwentyone’) and the error disappeared, at least in my case. I could see a whole bunch of JS errors in the browser console log (F12 in Chrome).

    I did check out the temporary folder stuff above, but it didn’t seem to be key for me. Worth noting that my theme was VERY old and VERY broken (ie: PHP 5.6 days!), but just mentioning this in case someone else like me has tried everything else!

    Moderator t-p

    (@t-p)

    Side note to @brianoz ,

    Thanks for helping out.

    It’s been about a YEAR since the OP posted. If you are looking for topics that could benefit from your help, try looking in https://www.ads-software.com/support/view/no-replies

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Missing a temporary folder error’ is closed to new replies.