
Jasmine
Administrator
Aug 6, 2000, 9:00 AM
Post #2 of 2
(1544 views)
|
Re: Uploads images using cgi-lib.pl
[In reply to]
|
Can't Post
|
|
Actually, you may wish to toss cgi-lib.pl out the window and replace it with CGI.pm. cgi-lib.pl was popularly used with Perl4, but CGI.pm is the "de facto standard" for Perl5+. Using CGI.pm, you can use the following code to upload files: For your form tag and file upload field: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> print start_multipart_form(); filefield(-name=>'upload',-size=>60),br, submit(-label=>'Upload File'), end_form; </pre><HR></BLOCKQUOTE> Then, to process the input: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $file = param->{'upload'}; open(SAVE,"filenametosave") | | die $!; while(read($file,$data,1024)){ print SAVE $data; } close SAVE; </pre><HR></BLOCKQUOTE> In other words, I don't know how to use cgi-lib.pl, only CGI.pm. You may have a hard time finding someone who knows enough to help you with that dinosaur (The above code was excerpted from "Official Guide to Programming with CGI.pm" by Lincoln Stein. Publisher: Wiley Computer Publishing) Footnote: if you're interested in converting your scripts from cgi-lib.pl to CGI.pm, check out Lincoln Stein's "Porting cgi-lib.pl Scripts to CGI.pm" article at http://stein.cshl.org/WWW/software/CGI/cgi-lib_porting.html
|