mojobozo has asked for the wisdom of the Perl Monks concerning the following question:
<form method=post action=upload.cgi name=upload_epic enctype="multipar +t/form-data"> <input type=file size=20 name=upload> <br><input type=submit value=submit> </form>
#!/usr/local/bin/perl use CGI qw/:standard/; use File::Basename; &print_return_page_top; print_results(); sub print_results { my $q = new CGI; my $length; my $file = $q->param('upload'); my $time = time; if (!$file) { print "No file uploaded."; return; } ($base,$path,$type) = fileparse($file,'\..*'); my $uploaded_path = "\\path\\to\\uploaded_files\\"; $uploaded_path .= $base; $uploaded_path .= "_"; open FILE, ">$uploaded_path$time$type"; binmode FILE; while ($bytesread=read($file,$buffer,1024)) { print FILE $buffer; } print h2('Success!'),"$file has been uploaded."; } &print_return_page_bottom;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Uploading: IE vs. NS
by tachyon (Chancellor) on Nov 13, 2002 at 15:54 UTC | |
by mojobozo (Monk) on Nov 13, 2002 at 16:21 UTC | |
|
Re: File Uploading: IE vs. NS
by Abigail-II (Bishop) on Nov 13, 2002 at 16:01 UTC | |
|
Re: File Uploading: IE vs. NS
by fruiture (Curate) on Nov 13, 2002 at 15:53 UTC | |
|
Re: File Uploading: IE vs. NS
by Mr. Muskrat (Canon) on Nov 13, 2002 at 15:50 UTC |