Problem with file upload in forum

M

Maarten

I'm running a forum on a debian box and all of a sudden my uploads don't
seem to be working anymore.

The code for the upload is the folowing:

sub _save_file{
my ($self, $file_hdr, $file_name) = @_;
my ($ret, $bytesread, $data);

open (SAVE, ">$config->{'file_path'}/$file_name") or die "an error
occured:
while ($bytesread = read($file_hdr,$data,1024)) {
print SAVE $data;
}
close SAVE;
$ret = -s "$config->{'file_path'}/$file_name";
return $ret;

Is there something wrong with this code?
Because I'm getting files with a filesize of 0 kb instead of the real
filesize.
 
J

Joe Smith

Maarten said:
I'm getting files with a filesize of 0 kb instead of the real filesize.
sub _save_file{
my ($self, $file_hdr, $file_name) = @_;

return(warn("file_hdr is not an open file handle"),-1)
unless defined fileno($file_hdr);

-Joe

P.S. Post to comp.lang.perl.misc instead of comp.lang.perl next time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top