Just to follow up ... Greg found the problem to be that Apache 1.3.11
did some kind of Russian encoding, including multipart/form-data 
content, so that 0x00 data was converted to 0x20 automatically.

This would then mangle the file uploads.  *Whew* glad that's 
solved ! :)

-- Joshua
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

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... :((
> 
> >
> > 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;
> }
> 
> 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...

Reply via email to