Well, the original reason I didn't use that was I didn't know what "linking" it was used for... (so much for RTFM... :) ).
However, my /tmp (which Apache is using as it's tmp-directory) is on its own partition, so I cant really link it anywhere else but /tmp, which is not exactly where I'd like it to go... Is there any other way to get it saved directly like that, and not having to cp it somewhere else? (and I'd still like to know why my original code doesn't work... :) ) Thanks alot for the advice, though! cheers Snorre On Tue, 22 Oct 2002, Issac Goldstand wrote: > 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? > > >