I know someone is going to laugh when they read this question, but I am trying to create a web site that makes life really easy on this one group on campus to upload Word Documents up to a campus web server... I have never done a form upload before and it's really starting to piss me off... the upload part of the code is:
$file_name = param('file_name');
&save_file;
&Print_Error if($file_name eq "");
&Return_html;
sub save_file {
open (MYFILE, ">/user/s4/kendo/public_html/write/$file_name" )
+ || die $!;
while(<$file_name>){ print MYFILE $_; }
close(MYFILE);
}
sub Return_html {
print header();
print start_html('Upload Complete');
print "<h1>Your upload is complete!</h1>";
print "$file_name";
print end_html;
}
sub Print_Error {
print header(), start_html('Upload Error!');
print "<p>Field \'File Name\' must be filled in for
this script to work properly.</p>\n";
print end_html;
exit 0;
}
Any kind of help would be greatly 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.