wolverina has asked for the wisdom of the Perl Monks concerning the following question:
<HTML> <HEAD></HEAD> <BODY> <FORM ACTION="http://www.yoursite.com/cgi-local/up_load.cgi" METH +OD="post" ENCTYPE="multipart/form-data"> Photo to Upload: <INPUT TYPE="file" NAME="photo"> <br><br> <br><br> <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form"> </FORM> </BODY> </HTML>
#!/usr/bin/perl -w use CGI; $upload_dir = "/dir1/dir2"; $query = new CGI; $filename = $query->param("photo"); $filename =~ s/.*[\/\\](.*)/$1/; $upload_filehandle = $query->upload("photo"); open UPLOADFILE, ">$upload_dir/$filename"; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE; print $query->header ( );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: upload script
by b10m (Vicar) on Dec 21, 2003 at 10:32 UTC | |
|
Re: upload script
by jZed (Prior) on Dec 22, 2003 at 02:19 UTC |