I tried many ways, Though I am seeing the file. the SIZE IS 0.
I tried out these ways
First One
=============
my $upload_file= $q->param('upload_file'); # This is the description file which
is being uploaded
if ($upload_file)
{
my $outfile="/home/anish/testing.doc";
open(OUTFILE,">$outfile") or warn "can't write $outfile: $!";
print OUTFILE <$upload_file>;
close(OUTFILE);
}
================
Second Method
============
my $upload_file= $q->param('upload_file'); # This is the description file which
is being uploaded
my $outfile="/home/anish/testing.doc";
my $bytes_read=0;
my $size='';
my $buff='';
my $start_time;
my $time_took;
if (!open(WFD,">$outfile"))
{
print "<BR> Cannot Write the file ";
exit(-2);
}
$start_time=time();
while ($bytes_read=read($upload_file,$buff,2096))
{
$size += $bytes_read;
binmode WFD;
print WFD $buff;
}
close(WFD);
if ((stat $outfile)[7] <= 0)
{
unlink($outfile);
print "Could not upload file: $upload_file";
return;
}
else
{
$time_took=time()-$start_time;
print "The Time Took is $time_took and the size is $size";
}
============