470,849 Members | 1,515 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Problem with file upload in forum

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.
Jul 19 '05 #1
1 2857
Maarten wrote:
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.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by John Machin | last post: by
4 posts views Thread by R Reyes | last post: by
5 posts views Thread by Segfahlt | last post: by
8 posts views Thread by Cristian | last post: by
1 post views Thread by Redapple | last post: by
11 posts views Thread by kj | last post: by
12 posts views Thread by K. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.