Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Problem with file upload in forum

Thread Tools

Problem with file upload in forum

Posts: n/a
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
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

Reply With Quote
Joe Smith
Posts: n/a
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);


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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload a file without file Upload control - ASP.Net =?Utf-8?B?U2FyYXY=?= ASP .Net 3 08-03-2005 01:09 AM
[Ruby Forum] Forum digest by email Alexey Verkhovsky Ruby 0 09-22-2004 07:21 PM
How to detect sizeof upload in order to show status of browser file upload? Heather Fraser Java 0 07-05-2004 12:35 AM