How to read a jpg bytearray from a Flash AS3 file

Tim Roberts timr at probo.com
Thu Oct 2 03:11:33 EDT 2008


rsgalloway at gmail.com wrote:
>
>Thanks! I'm using form = cgi.FieldStorage(). When I print out the
>contents of form, I get this:
>
>    FieldStorage(None, None, '\xff\xd8\xff\xe0\x00\x10JFIF
>\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb
>\x00\x84\x00\x05\x03\x04\x04\x04\x03\x05\x04\x04\x04\x05\x05\x05\x06\x07\x0c
>\x08\x07\x07\x07\x07\x0f\x0b\x0b\t\x0c\x11\x0f\x12\x12\x11\x0f
>\x11\x11\x13\x16\x1c\x17\x13\x14\x1a\x15\x11\x11\x18!\x18\x1a\x1d\x1d
>\x1f\x1f\x1f\x13\x17"$"\x1e$\x1c\x1e\x1f\x1e
>\x01\x05\x05\x05\x07\x06\x07\x0e\x08\x08\x0e\x1e\x14\x11\x14\x1e\x1e
>\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e
>\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e
>\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\xff\.....
>
>Which is obviously the binary data of the image I want. How do I
>access this data? I'm used to getting it like this:
>
>    name = form['name'].value
>
>But I don't think this will work in this case. TIA.

What led you to ask that here, instead of taking 60 seconds to load cgi.py
in an editor and search for the FieldStorage class?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list