Greg wrote: > > ----- Original Message ----- > From: Joshua Chamas <[EMAIL PROTECTED]> > To: Greg <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, February 01, 2000 6:28 AM > Subject: Re: Can't upload binary file (Apache::ASP sample) > > > > > So first, I might use a sysread(FILEHANDLE,SCALAR,LENGTH,OFFSET) > > call to slurp the binary into a scalar, then if you want to print > > it, try a $Response->BinaryWrite() as shown at: > > > > I have to save file at server, and as response simply make link to it (<IMG > SRC=...>). > I've tried to use sysread & syswriteb but result remained the same: 0x20 > instead 0x00... :(( > So we'll get things to work! > > > > If you want to make your example above work, try setting OUT > > to binmode, with binmode(OUT), before you write to it. > > I'm sure that file uploads - filesize is the same, but content differs... > and this code works fine at local machine: > > if ((open IN, "<in.jpg") && (open OUT, ">out.jpg")) { > binmode(IN); > binmode(OUT); > while (<IN>) { print OUT $_; } > close IN; > close OUT; > } > In your example code that you sent earlier, you had not used binmode on OUT, so you should try it if you haven't already. > so I think all trouble is in $filehandle.. no I'm SURE! > that code works perfectly fine on test data, and there is no mess with 0x00 > and 0x20! > > i've read something about filehandles at > http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#upload_caveats - that > it must be obtained throug different package - like that: > > $file = $query->param('file to upload'); > $file = "main::$file"; > ... > > but I don't know what package I have to use... The file handle you get from $Request->Form('file') is the same file handle that CGI.pm returns from $query->param() If you can't get it to work, send me the code that is supposed to work and I'll see what's happening. -- Joshua _________________________________________________________________ Joshua Chamas Chamas Enterprises Inc. NodeWorks >> free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com 1-714-625-4051