Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File Upload
Message
 
 
À
Tous
Information générale
Forum:
Perl
Catégorie:
CGI/HTTP - Applications Internet
Titre:
File Upload
Divers
Thread ID:
00686862
Message ID:
00686862
Vues:
73
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;
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform