cbanker has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use CGI(); my $query = new CGI; $upload_dir = "/tmp"; print "Content-type: text/html\n\n"; print "<html><head>\n"; print "<title>BFT File Upload</title></head>\n"; print "<body>\n"; print "Processing Uploaded File...<br />"; $sscfFile = $query->param('sscfFile') || ''; if ($sscfFile =~ /([\w .-]+)$/i) { #strip off path stuff $sscfFile = $1; } else { error("Could not generate filename $!"); } open (UPLOADFILE, ">$upload_dir/$sscfFile") || (error("Cannot open fil +e $upload_dir/$sscfFile $!")); binmode UPLOADFILE; while ($bytesread=read($sscfFile,$buffer,1024)) { $totalbytes += $bytesread; print UPLOADFILE $buffer; } close UPLOADFILE; print "</body></html>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Upload without using CGI.pm upload function
by ikegami (Patriarch) on Jun 25, 2009 at 17:55 UTC | |
|
Re: File Upload without using CGI.pm upload function
by trwww (Priest) on Jun 25, 2009 at 23:50 UTC | |
by cbanker (Beadle) on Jun 26, 2009 at 23:25 UTC | |
by cbanker (Beadle) on Jun 29, 2009 at 21:16 UTC |