Um... Why don't you simply use $upload->link on the handle?

<From Apache::Request manpage>
  my $upload = $apr->upload('file');
  $upload->link("/path/to/newfile") or
      die sprintf "link from '%s' failed: $!", $upload->tempname;
</From Apache::Request manpage>

  Issac

----- Original Message -----
From: "Leif Snorre Schøyen Boasson" <[EMAIL PROTECTED]>
To: "mod_perl" <[EMAIL PROTECTED]>
Sent: Tuesday, October 22, 2002 6:08 PM
Subject: Problems writing binary uploaded data...


> I'm trying to save an uploaded binary file (a jpg) through a perlscript.
> The code doing this looks like:
>
>    if (open OUTFILE, ">/var/www/tmp/test.jpg"){
>
>        binmode $ULFILE, ":raw";
>        binmode OUTFILE, ":raw";
>
>        while ($sizeread=read($ULFILE, $buffer, 1024)) {
>            print OUTFILE $buffer;
>            $size += $sizeread;
>        }
>
>        print "<br>Read ",$size," bytes.";
>    }
>
> Where ULFILE is the filehandle for the uploaded file, gotten from an
> Apache::Request object. Now, the sum of the sizes reported by the
> read-command is correct for the original jpg file I use to test, but the
> written file is somewhat smaller (7192 bytes smaller), so I figure
> something gets lost in the writing. But I cant figure out how or why...
>
> ...anybody see some reason why I shouldnt get the exact binary data out?
>

Reply via email to