I use perl cgi to upload file(any type: text or image) from web browser. The file was created, but is empty.
The following is my html form file and perl cgi called by the form. Can any one help me this issue? Justin perl cgi file: #!/usr/bin/perl use CGI; $query = new CGI; print "Content-type: text/html\n\n"; print "<html><head><title>Perl CGI Example # 2"; print "</title></head><body><h1>"; print "Perl CGI Example # 2</h1><p>"; $query->import_names('R'); $upload_dir = "/var/www/cgi-bin"; # $query = new CGI; # print "this part"; $filename = $query->param("photo"); # print "$filename"; $email_address = $query->param("email_address"); $filename =~ s/.*[\/\\](.*)/$1/; # print " 0 $filename"; $upload_filehandle = $query->upload("photo"); open UPLOADFILE, ">$upload_dir/$filename"; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE; print "</p>"; print "</body></html>"; html file which calls above perl cgi file. <HTML> <HEAD></HEAD> <BODY> <FORM ACTION="cgi-bin/upload.cgi" METHOD="post"> <INPUT TYPE="file" NAME="photo"> <br><br> <INPUT TYPE="text" NAME="email_address"> <br><br> <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form"> </FORM> </BODY> </HTML> __________________________________ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>