Hey there,
I am using the CGI module to do many great things on the web.
One of these is file uploading, and this is the first time i have used this specific feature.
It works fine but not every time.
I can browse to find a file to upload, it creates a file on the server of the same name, refreshes the page showing the contents of the folder it has been uploaded to and everything seems to be fine.
BUT sometimes the file uploaded shows as 0kb and so isn't really there.
I have set the upload to BINMODE so that it should handle all files without problem.
CODE
####
sub uploading { ## the upload sub
my $uploadpath = "$homepath$section/documents/";
$_[0] =~m/.*[\/\\](.*)$/;
$nname = $1; #print $nname;
open (UPFILE, ">$uploadpath$nname" or oops("Can't open upload file handle: $!"
binmode(UPFILE);
while ( <$ufile> ) { print UPFILE $_; }
close UPFILE;
$lastaction = "Last Action:<b> $nname </b>Uploaded";
}
this sub routine is called as follows;
$ufile = param('upld');
if ($ufile) { &uploading($ufile); }
################
The inconsistentcy comes from successfully uploading one MSWord file, then failing on another but retrying with the same documents works the opposite way round.
Basically the documents I have tested with are sometimes uploaded and sometimes not.
If anyone can shed light on this or other problems I might get from this module plese help.
Spec: - NT 5 IIS 5, and IE6
Cheers
Jez
I am using the CGI module to do many great things on the web.
One of these is file uploading, and this is the first time i have used this specific feature.
It works fine but not every time.
I can browse to find a file to upload, it creates a file on the server of the same name, refreshes the page showing the contents of the folder it has been uploaded to and everything seems to be fine.
BUT sometimes the file uploaded shows as 0kb and so isn't really there.
I have set the upload to BINMODE so that it should handle all files without problem.
CODE
####
sub uploading { ## the upload sub
my $uploadpath = "$homepath$section/documents/";
$_[0] =~m/.*[\/\\](.*)$/;
$nname = $1; #print $nname;
open (UPFILE, ">$uploadpath$nname" or oops("Can't open upload file handle: $!"
binmode(UPFILE);
while ( <$ufile> ) { print UPFILE $_; }
close UPFILE;
$lastaction = "Last Action:<b> $nname </b>Uploaded";
}
this sub routine is called as follows;
$ufile = param('upld');
if ($ufile) { &uploading($ufile); }
################
The inconsistentcy comes from successfully uploading one MSWord file, then failing on another but retrying with the same documents works the opposite way round.
Basically the documents I have tested with are sometimes uploaded and sometimes not.
If anyone can shed light on this or other problems I might get from this module plese help.
Spec: - NT 5 IIS 5, and IE6
Cheers
Jez