Hi,
I try to upload a file from a local disk located in Windows machine to a Linux server via HTTP application developed in Perl. But when I check the upload result, I find that the size is zero. I think that is something wrong related to the path where the script try to get.
Have you any idea about his issue?
Thanks.
Here is the code:
======================
#!/usr/bin/perl
my $b_r=0;
my $size='';
my $buffer='';
$fpath='E:\Documents and Settings\Administrator\My Documents\test_aa.pps';
$upload_path="/pcs/plac";
if ($fpath =~ /([^\/\\]+)$/)
{
$fname="$1";
}
else
{
$fname="$fpath";
}
$fname =~ s/\s+//g;
$wfile="$upload_path" . "/" . "$fname";
if (!open(FILE1,">$wfile"))
{
print "problem \n";
return;
}
while ($b_r=read($fpath,$buffer,2096))
{
$size += $b_r;
binmode FILE1;
print FILE1 $buffer;
}
close(FILE1);
I try to upload a file from a local disk located in Windows machine to a Linux server via HTTP application developed in Perl. But when I check the upload result, I find that the size is zero. I think that is something wrong related to the path where the script try to get.
Have you any idea about his issue?
Thanks.
Here is the code:
======================
#!/usr/bin/perl
my $b_r=0;
my $size='';
my $buffer='';
$fpath='E:\Documents and Settings\Administrator\My Documents\test_aa.pps';
$upload_path="/pcs/plac";
if ($fpath =~ /([^\/\\]+)$/)
{
$fname="$1";
}
else
{
$fname="$fpath";
}
$fname =~ s/\s+//g;
$wfile="$upload_path" . "/" . "$fname";
if (!open(FILE1,">$wfile"))
{
print "problem \n";
return;
}
while ($b_r=read($fpath,$buffer,2096))
{
$size += $b_r;
binmode FILE1;
print FILE1 $buffer;
}
close(FILE1);