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]ups.com, "Matt Chotin" <[EMAIL PROTECTED]> 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]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of bondbeer
> Sent: Tuesday, August 15, 2006 4:11 PM
> To: [EMAIL PROTECTED]ups.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> ";
> var request:URLRequest = new URLRequest(url);
> request.contentType = "multipart/form-data";
> request.method = URLRequestMethod.POST;
>
> // Set the data
> request.data = ""> >
> 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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to