Hi
I begin in perl and i wrote i little programm to upload a file and I want to wrote this file in in a new file but the file stay empty.
this is my code
use CGI;
my $q=new CGI();
print $q->header();
print $q->start_html("UPLOAD FILE");
print $q->start_form();
print $q->filefield('upload_file','starting value',50,80);
print $q->submit();
print $q->end_form();
if ($q->param('upload_file'))
{
my $fh=$q->upload('upload_file');
open (OUTFILE,">>allo.txt");
my $bytesread="";
my $buffer = "";
while ($bytesread=read($fh,$buffer,1024))
{
print OUTFILE $buffer;
}
close(OUTFILE);
}
print $q->end_html();
I begin in perl and i wrote i little programm to upload a file and I want to wrote this file in in a new file but the file stay empty.
this is my code
use CGI;
my $q=new CGI();
print $q->header();
print $q->start_html("UPLOAD FILE");
print $q->start_form();
print $q->filefield('upload_file','starting value',50,80);
print $q->submit();
print $q->end_form();
if ($q->param('upload_file'))
{
my $fh=$q->upload('upload_file');
open (OUTFILE,">>allo.txt");
my $bytesread="";
my $buffer = "";
while ($bytesread=read($fh,$buffer,1024))
{
print OUTFILE $buffer;
}
close(OUTFILE);
}
print $q->end_html();