Thathom has asked for the wisdom of the Perl Monks concerning the following question:
Ok, heres the script I have so far. It uses CGI.pm and passes through a text variable and tells me the file name thats going to be uploaded. It works great. (so far). How do I upload the file to the UPLOAD_DIR?
Genius wanted.....:)
Script:input type=file name=file input type=text name=var1
Sooo close!!!.......#!/usr/bin/perl use CGI; use constant BUFFER_SIZE => 16_384; use constant MAX_FILE_SIZE => 48_576; use constant UPLOAD_DIR => "/absolute/path/to/"; $CGI::DISABLE_UPLOADS = 0; $CGI::POST_MAX = MAX_FILE_SIZE; my $req = CGI->new;<br> my $var1 = $req->param('var1'); my $file = $req->param("file"); if ($file) { my $buffer; my $file_handle = $req->upload( $file ); my $format = $req->uploadInfo($file)->{'Content-Type'}; } print "Content-type: text/html\n\n"; print "Passed Variable = $var1<p>"; print "File name = $file<p>\n"; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Upload - What Next?
by tachyon (Chancellor) on Jul 06, 2001 at 00:55 UTC | |
by Thathom (Acolyte) on Jul 06, 2001 at 10:48 UTC | |
by Thathom (Acolyte) on Jul 06, 2001 at 12:59 UTC | |
by arturo (Vicar) on Jul 06, 2001 at 15:29 UTC | |
by Anonymous Monk on Jun 20, 2002 at 08:37 UTC | |
|
Re: File Upload - What Next?
by PrakashK (Pilgrim) on Jul 06, 2001 at 00:40 UTC | |
by Thathom (Acolyte) on Jul 06, 2001 at 10:50 UTC |