CGI / Binary Read

Yennie at aol.com Yennie at aol.com
Tue Feb 5 01:30:01 EST 2002


<< If all else fails compress the file before uploading and decompress on
the server.
Make sure you get all the data over (same length before and after)!! >>

Unfortunately, my clients won't like that much =).
The weird thing is, the $CONTENT_LENGTH is being reported as "48", and my 
graphic is certainly larger than that (I'm uploading JPEG files to be 
analyzed by the CGI). So, I'm getting the 48 bytes as reported, but that's 
it. Where's the rest? I'm running under Apache and Darwin...

Here's my script in case anyone catches something...

#!mc
on startup
  set the shellCommand to "/bin/tcsh"

  put $CONTENT_LENGTH into theLength
  put $CONTENT_TYPE into theType
  put char (offset("boundary=",theType) + 9) to -1 of theType into theBoundary

  read from stdin until eof
  put it into theArgs

  put "Length:"&theLength&"<BR>" after theText
  put "Boundary:"&theBoundary&"<BR>" after theText 
  put "Args:"&theArgs after theText

  put "Content-Type: text/html"
  put "Content-Length: "&length(theText)&cr&cr
  put theText

end startup


Regards,
Brian



More information about the metacard mailing list