Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Problem with file upload in forum

 
 
Maarten
Guest
Posts: n/a
 
      07-30-2004
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.


 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      07-31-2004
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.
 
Reply With Quote
 
 
 
Reply

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



Advertisments