Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI.PM Upload TMP Directory

Status
Not open for further replies.

john30120

Technical User
Dec 7, 2001
22
US
Using a Perl script to process a file upload, I am trying to assign the temp directory to an existing r/w enabled folder (windows box) on my website.

Apparently, cgi.pm looks for a "/tmp" folder off the root and if not found sticks the file in the cgi-bin directory with the Perl script (shouldn't be write enabled).

use CGI;
$TempFile::TMPDIRECTORY='/files';

is supposed to reassign the TMP directory to "files" folder but doesn't work. The server is off site so I can't modify cgi.pm directly. I have tried using the full server path with the above command to no avail. Any Ideas?
 
why don't you post the script that does the uploading so we can see what you might do wrong.
By the way the CGI is not responsible to where the file gets uploaded, you are.


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
##### HTML Code
# <FORM name="Upload" ACTION = "/cgi-bin /upload/uploadDisplay.pl" ENCTYPE="multipart/form-data" METHOD="post">
# <INPUT TYPE="file" NAME="UploadFile">
# <input type="submit">
# </form>
### End HTML

# script at /cgi-bin/upload/uploadDisplay.pl

use CGI;
$CGI::DISABLE_UPLOADS = 0;
$CGI::pOST_MAX = 128 * 1024;
binmode(STDIN);
$filename = $query->param("UploadFile");
$tmp_file = $query->tmpFileName($filename);

# at this point $tmp_file will point to the uploaded file "CGI******" placed in if it is available or written in the cgi-bin directory where this script is. I'd like it in /files/tmp
 
oops... I left out a vital line in the cgi script.

use CGI;
$CGI::DISABLE_UPLOADS = 0;
$CGI::pOST_MAX = 128 * 1024;
binmode(STDIN);
$query = new CGI;
$filename = $query->param("UploadFile");
$tmp_file = $query->tmpFileName($filename);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top