Gossamer Forum
Home : Products : Others : Fileman :

Can't upload Gif and jpg files correctly

Quote Reply
Can't upload Gif and jpg files correctly
 I've just installed File Manager version 1.0 and all gif and jpg files upploaded are corrupted. I've read some messages concerning this problem at the forum, but the cgi code seems to be right. What can be possibly wrong?
Quote Reply
Re: Can't upload Gif and jpg files correctly In reply to
hi webranger:

Can you locate these lines in sub upload in fileman.cgi:
open (OUTFILE, ">$fullfile") or &cgierr ("Can't open: '$fullfile'.\nReason: $!");
binmode (OUTFILE); # For those O/S that care.

The important thing is that you have binmode (OUTFILE) because it seems to me that your gif and jpg files have been uploaded in ASCII mode.

Please check this out and get back to me and I will see what I can do to solve the problem.

Cheers
Sun
Quote Reply
Re: Can't upload Gif and jpg files correctly In reply to
I've found these lines in the code :
What can possibly be up with it?
--------------------------------
open (OUTFILE, ">$fullfile") or &cgierr ("Can't open: '$fullfile'.\nReason: $!");
binmode (OUTFILE); # For those O/S that care.
while ($bytesread=read($data,$buffer,1024)) {
($fullfile =~ /cgi|pl$/) and ($buffer =~ s/\r//g);
print OUTFILE $buffer;
$file_size += 1024;
if (($file_size / 1000) > $free_space) {
close OUTFILE;
unlink ($fullfile) or &cgierr ("Can't unlink: $fullfile. Reason: $!");
return (0, "Upload: Not enough free space to upload that file. Space left: