in reply to Re^5: Upoading file using perl
in thread Upoading file using perl
Hi, my web page for the user to upload the code is as below:
#!/usr/bin/perl -w use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI::Session ( '-ip_match' ); my $session = CGI::Session->load(); #my $sid = $cgi->cookie("CGISESSID") || undef; #my $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'}); if($session->is_empty){ print redirect('index.cgi'); } elsif($session->is_expired){ print redirect('index.cgi?status=expired'); } else{ print "Content-type: text/html\n\n"; print <<EOD; <html> <head> <title>NTU Earth Observatory Station</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> <link rel="stylesheet" href="/css/styles.css" type="text/css"> </head> <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" m +arginheight="0"> <form name="frmHome" method="POST" action="upload.cgi" enctype="multip +art/form-data"> <table width="780" cellspacing="0" cellpadding="0" border="0" align="c +enter"> <tr> <td height="100"> <img src="../imgs/banner.jpg" width="100%" height="100%"></td> </tr> </table> <table width="780" cellspacing="0" cellpadding="0" border="0" align="c +enter"> <tr> <td bgcolor="#CCCCCC" height="250" valign="top" width="160"> <table width="160" cellspacing="0" cellpadding="8" border="0"> </table> </td> <td bgcolor="#eeeeee" height="250" valign="top"> <table width="610" cellspacing="10" cellpadding="0" align="cente +r" border="0"> <tr> <td valign="top" class="text"> <div><p>File to Upload: <input type="file" name="file" / +></p></div> <div align="right"><p><input type="submit" name="submit" + value="Submit" /></p></div> </td> </tr> </table> </td> </tr> </table> <table width="780" cellspacing="0" cellpadding="0" height="40" border= +"0" align="center"> </table> </form> </body> </html> EOD }
Thanks a lot!
|
|---|