The upload failed because the temporary directory was missing.

When I try to upload some attach or avatars XenForo alerts me: "The upload failed because the temporary directory was missing. The site administrator will need to resolve this before any files can be uploaded."
How can I fix it?
 
We have this same error when trying to upload images to a post or to the photo gallery or to a private conversation. This has only started happening since our server host had to rebuild our forum from a backup following a hardware error. Any clues what we can do to fix it?
Screenshot_20201228-150428__01.webp
 
Many thanks Brogan.
Has that error been caused by the rebuild?
Is that line meant to be in the php.ini file normally?
 
Your host must have changed something on the server as part of the rebuild.

If you contact them they should be able to resolve it by setting the temp directory and ensuring it is writable.
 
We discovered the problem. We were exceeding the storage quota on the server, caused by all the backup files stored there during the recovery process. Image uploads now seem to be working correctly again. Many thanks.
 
I am still having this issue even though I have the correct permissions, file size allocation, and upload directory set in my php.ini file. What else could be causing this error? This is hosted locally on windows server 2019 IIS10.

[edit]
I fixed this by creating a sample php script to isolate my uploading error. Turns out php8 doesn't have gd2 or xmlrpc installed by default. luckily I had an older php installation and copied the extensions from there, and added them to my php.ini file.

For future readers having the same problem it's worth taking look at if you're only using php8. I cannot find any official download anywhere so you may need to extract it from an older installation if available. If the download is available on their site I couldn't find it.
 
Last edited:
Turns out php8 doesn't have gd2 or xmlrpc installed by default.
Could this be due to the name change?

I found this article:
Since PHP 8.0, GD extension has been renamed on Windows. DLL file name has been changed from php_gd2.dll to php_gd.dll.

If you are migrating from PHP 7 to PHP 8 and just copy the php.ini file without doing any changes, you will get a warning during PHP startup. Make sure that php.ini file contains a line extension=gd instead of extension=gd2 in PHP 8.0 or newer versions.

On Linux, GD extension name is gd.so and it hasn't changed.
 
Could this be due to the name change?

I found this article:
I don't think so. I had the "php_gd.dll" enabled already and it didn't work. I think it may be where the new xenforo version isn't up to date with php8 -but I could be dead wrong. I assume this because it was specifically looking for the gd2 extension. Its also possible that may download just didn't include it at the time. I copied the file and never got any warnings either. I copied it from php5.6.4 though so maybe that's why. It was such a stupid little error but it's finally fixed. Same goes for the "xmlrpc" extension. I'm still relatively new to this so it's possible that something was overlooked.
 
Back
Top Bottom