Problem with file upload in forum

Discussion in 'Perl' started by Maarten, Jul 30, 2004.

  1. Maarten

    Maarten Guest

    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.
     
    Maarten, Jul 30, 2004
    #1
    1. Advertising

  2. Maarten

    Joe Smith Guest

    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.
     
    Joe Smith, Jul 31, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,456
    Bruce Barker
    Aug 3, 2005
  2. Heather Fraser
    Replies:
    0
    Views:
    638
    Heather Fraser
    Jul 5, 2004
  3. Replies:
    1
    Views:
    941
    Gabriel Genellina
    Nov 25, 2006
  4. Prakash
    Replies:
    3
    Views:
    465
    Ray at
    Nov 12, 2003
  5. Alexey Verkhovsky

    [Ruby Forum] Forum digest by email

    Alexey Verkhovsky, Sep 22, 2004, in forum: Ruby
    Replies:
    0
    Views:
    418
    Alexey Verkhovsky
    Sep 22, 2004
Loading...

Share This Page