I used the JPEG encoder from Tinic's blog - works like a charm! So essentially the ByteArray contains pure JPEG data (which I've confirmed by writing the contents to a file).
I think you're right tho - it is Raw binary. It just seems bizarre that URLRequest would implement posting Binary data that way, considering that it's supposed to be retrieving a response from the server - you need a specialized handler to process the binary data and then return a response to URLRequest. Even stranger when FileRef handles binary posts "properly". Thanks again Matt - I guess I'll just manually Base64 Encode the ByteArray and post as a regular URLVariables load. B. --- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> wrote: > > Yeah, I'm pretty sure it's going to be the raw binary, dependent on how > you wrote into the array. If you did writeObject you're going to have > AMF encoded data in there as well. So how did you write the bitmap > data? Is it PNG encoded a la Tinic's blog or did you just call > getPixels() on a BitmapData? Maybe that's simply going to be a series > of ints that you need to read off? > > > > Matt > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of bondbeer > Sent: Wednesday, August 16, 2006 1:49 PM > To: [email protected] > Subject: [flexcoders] Re: Posting ByteArray with URLRequest... > > > > > Thanks Matt, > > I had tried not setting the contentType (it's only in the code below > as I grasped at straws to get things working). But the data still > comes across without key/value pairs. The data is there server-side > but appears to be unformatted (raw, as you say). > > I guess my question is - can ByteArray data only be posted as a Raw > POST? Seems odd as that would essentially exclude binary posts to > regular PHP / ASP / RoR server-side scripts with URLRequest? If I > have to write a custom handler (or Base64 encode the binary data and > post as a regular form post) that's fine - just want to make sure I > wasn't missing the obvious. > > B. > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> > , "Matt Chotin" <mchotin@> wrote: > > > > Try not setting the contentType yourself and see what gets sent? It > > probably will just be raw binary data that you have to interpret on > your > > own? > > > > > > > > ________________________________ > > > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> > ] On > > Behalf Of bondbeer > > Sent: Tuesday, August 15, 2006 4:11 PM > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] Posting ByteArray with URLRequest... > > > > > > > > > > Hi Guys, > > > > I've seen this question posted previously with no answer given. In > > the AS3 docs, it outlines that you can submit ByteArray data to a > > server-side script by setting the URLRequest.data property to the > > array. The problem is the docs don't seem to indicate how that data > > is sent server-side - i.e. what's the key/value pair used? > > > > My server-side code gets triggered, but the data sent doesn't look > > like a regular multipart form data that you would receive from a File > > upload. I can't parse the data. > > > > Here's what I'm doing (the dataToPost ByteArray will contain Bitmap > > data): > > > > public function postData(dataToPost:ByteArray):void > > { > > // Create a loader and init it's events > > var loader:URLLoader = new URLLoader(); > > configureListeners(loader); > > > > // Create a Request object > > var url:String = "http://localhost/test/upload.aspx > <http://localhost/test/upload.aspx> > > <http://localhost/test/upload.aspx <http://localhost/test/upload.aspx> > > "; > > var request:URLRequest = new URLRequest(url); > > request.contentType = "multipart/form-data"; > > request.method = URLRequestMethod.POST; > > > > // Set the data > > request.data = dataToPost; > > > > try > > { > > // Execute the send > > loader.load(request); > > } > > catch (error:Error) > > { > > trace("Unable to load requested document."); > > } > > } > > > > Thanks for any insight! > > > > B. > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

