General information
Category:
CGI/HTTP - Internet Apps
Can anybody explain how to receive files, which have been sent by browser usign field in perl.
I have got some examples, but in the end the file is created on the server and it is empty (0bytes)
use CGI qw/:standard/; <- what the hell is that?
my $file = param('file_name'); <- how it comes it gets a value
$upload_dir = "/home/sites/www.dhpon.net/web/intranet/";
$upload_file = "dddr.tmp";
$MAXIMUM_UPLOAD = 500000;
my $file = $FORM{'file_name'};
open (SAVE, ">$upload_dir/$upload_file");
$data = 0;
$i1 = 0;
$TOTAL_BYTES = 0;
while ($Bytes = read($file,$data,1024)) {
$TOTAL_BYTES += $Bytes;
if (($TOTAL_BYTES > $MAXIMUM_UPLOAD) && ($MAXIMUM_UPLOAD > 0)) {
$i1 = 1;
last;
}
print SAVE $data;
}
close SAVE;
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only