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