CGI Open Of Tmpfile
Question
When uploading files, I get the following error:
Got an error: CGI open of tmpfile: No such file or directory
Or
Got an error: CGI open of tmpfile: Permission denied
Answer
No such file or directory
Movable Type can't find the tmp folder on your server; the value for this directory is controlled by the TempDir setting in mt-config.cgi1:
# When processing uploaded files, if Movable Type notices that the file you
# uploaded already exists, it will allow you to overwrite the original file,
# by first asking for your confirmation. To do this, MT needs to write the
# uploaded data to a temporary file. That temporary file is stored in the
# directory specified by the TempDir setting; the value defaults to /tmp.
#
# TempDir /tmp/
You should check with your host about the location of this folder to make sure it exists; or you may just be able to create a folder yourself and adjust that path to point to the new folder you created (remember to uncomment the setting2).
On Windows, you may need to specify a full server path:
D:\full\path\to\tmp
Permission denied
If you're trying to upload a file for the first time, Movable Type does not have permissions to upload the file to the location you've designated. The permissions will need to be set so that Movable Type can write files to that location during the upload process (usually the equivalent of Unix 777).
If you're trying to upload a file which needs to overwrite an existing one, Movable Type may not have permissions to the tmp folder either, so those will also need to be set.
Another thing you can try if CGI.pm is installed in extlib is setting the path in it directly:
# $CGITempFile::TMPDIRECTORY = '/usr/tmp';
Uncomment the setting2 and replace /usr/tmp with the full server path to your tmp folder. Then, look for the following line (if it exists in your copy of the file):
undef $TMPDIRECTORY;
and comment it out3.
Save CGI.pm and upload it back to the server in ASCII mode.
1 In versions prior to 3.2, the configuration file is named mt.cfg.
2 To uncomment a setting means to remove the # from the beginning of the line where it appears.
3 To comment out means to place a # at the beginning of the line.


