JB,

Here's the solution which works for me. I know it seems a bit bizarre. It took many attempts to figure out how to get it to work reliably. But this works all the time.

Best,
Richard Miller

---------------------------
 -- buffer has the incoming data stream
  put buffer into temp
  put empty into pictfile
  put offset("image/jpeg",temp) into xx
  if xx <> 0 then
    put xx+14 into xx
    put char xx to (the length of temp) of temp into pictdata
    put char 1 to xx-1 of temp into tdata
    repeat with i = the length of pictdata down to 1
      if chartonum(char i of pictdata) is 0 then
        put i into holdit
        exit repeat
      end if
    end repeat
    delete char (holdit+1) to the length of pictdata of pictdata
    put "binfile:TempPict_" & the milliseconds & ".jpg" into PictFile
-- these next steps are critical. It doesn't work otherwise. Field "temp2" is just an empty text field on the cgi stack
    put pictdata into url PictFile
    put url PictFile into pictdata
    put pictdata into fld "temp2"
    put fld "temp2" into url PictFile

The file PictFile will now be a regular jpeg file you can read and manipulate as you would any jpeg file



On Apr 25, 2008, at 4:18 PM, jbv wrote:

Hi guys,

Has anyone already tried to parse data from a multipart/form-data html
form
(that contains a type=file element) with Rev cgi ?
I've done it successfully in the past with ascii data, but now I'm
trying to post
jpeg data along with other parameters (height & with of the pic, session
#...)
in the same form, and obviously the jpeg binary data get corrupted in
the process...

Any idea ? Or will I have to use php again (sigh) ?

Best,
JB

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to