Angharad has asked for the wisdom of the Perl Monks concerning the following question:
and this is the corresponding form<HTML> <HEAD></HEAD> <BODY> <FORM ACTION="/cgi-bin/upload.cgi" METHOD="post" ENCTYPE="multipart/fo +rm-data"> <h1>Welcome to the Online Server</H1> <br> Please submit your PDB co-ordinate file here. <br> File to upload: <INPUT TYPE="file" NAME="protein"> <br><br> <INPUT TYPE="submit" NAME="Submit" VALUE="Submit File"> </FORM> </BODY> </HTML>
When I try to run the cgi script via the html form I get the following error#!/usr/bin/perl -w use CGI; $upload_dir = "http://myname.tripod.com/mine"; $query = new CGI; $filename = $query->param("protein"); $filename =~ s/.*[\/\\](.*)/$1/; $upload_filehandle = $query->upload("protein"); open UPLOADFILE, ">$upload_dir/$filename"; binmode UPLOADFILE; close UPLOADFILE; print $query->header ( ); print <<END_HTML; <HTML> <HEAD> <TITLE>Thanks!</TITLE> </HEAD> <BODY> <P>Thanks for uploading your file!</P> </BODY> </HTML> END_HTML
Which I don't understand at all because it all seems ok to me.Your script produced this error: <br>Undefined subroutine CGI::upload + at CGI.pm line 349.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI script problem .. trying to upload files
by McDarren (Abbot) on Jan 10, 2006 at 14:57 UTC | |
|
Re: CGI script problem .. trying to upload files
by ptum (Priest) on Jan 10, 2006 at 14:34 UTC | |
by Angharad (Pilgrim) on Jan 10, 2006 at 14:41 UTC | |
by john_oshea (Priest) on Jan 10, 2006 at 14:51 UTC | |
by Angharad (Pilgrim) on Jan 10, 2006 at 15:11 UTC | |
by john_oshea (Priest) on Jan 10, 2006 at 15:24 UTC |