Hi there
I am trying to write a interactive webpage. This involves the user uploading a text file to the server and then a perl script running in the background to perform a task and give a response.
Anyway, I'm having problems with the scripts required to uploadthe necessary file.
This is the html 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>
and this is the corresponding form
#!/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
When I try to run the cgi script via the html form I get the following error
Your script produced this error: <br>Undefined subroutine CGI::upload
+ at CGI.pm line 349.
Which I don't understand at all because it all seems ok to me.
I was wondering whether the error could be partially due to me using tripod as my server (don't ask ... I've asked for a server for ages at work and have yet to recieve it .. the department one runs php scripts only). apparently tripod is a bit 'odd'.
Anyway .. any help or suggestions much appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.