Hi Andy,

I'm using remoting/AMF in other parts of my application, so I don't
think I'll have a problem sending the data to ColdFusion after it's
prepared. I just wasn't sure what to do with the data once I got it to
ColdFusion to turn it into a file (I'm fairly new to ColdFusion).

I'll take a look at the ColdFusion toBinary function and I assume that
after the data comes out of toBinary I can write the file using
cffile. Anyway, it gives me a foothold to get started :-) Thanks!

Paul

--- In [email protected], "Andrew Trice" <[EMAIL PROTECTED]>
wrote:
>
> Glad my blog entry helped. :-)    
> 
> You can use the as3  PNGEncoder or JPGEncoder libraries at
> http://code.google.com/p/as3corelib/ to do the image format conversion
> within the flex application.  You can post it to a server using either
> remoting, web service, or http service.  Remoting/AMF3 is fastest and
> easiest, but the other methods work well too.  Remoting does not require
> any base64 conversion for the binary data; you can send it "across the
> wire" as is.
> 
>  
> 
> -Andy
> 
>  
> 
> This is from a previous post I wrote here on flexcoders...
> 
>  
> 
> If you are using AMF3 (RemoteObject), you can serialize binary data
> without any conversion.  If you are trying a standard HTTP post, I would
> use a HTTPService with the method= "POST".  Then you have to Base64
> encode the binary data and attach it to the parameters of the http
> service.  On the server side, you will need to decode the base64 encoded
> data back into binary.
> 
>  
> 
> Example:
> 
>  
> 
> <mx:HTTPService 
> 
> id="httpService"
> 
>        showBusyCursor="true"
> 
>        useProxy="false"
> 
>        method="POST"
> 
>        resultFormat="text"
> 
>        url="/BinaryData/cf/HTTPImageSave.cfm" 
> 
> result="onResult('Data Saved via mx:HTTPService')" 
> 
> fault="onFault(event)" />
> 
>  
> 
> private function base64Encode( data : ByteArray ) : String
> 
> {
> 
>             var encoder : Base64Encoder = new Base64Encoder();
> 
>             encoder.encodeBytes( data );
> 
>             return encoder.flush();
> 
> }
> 
>  
> 
> private function sendData() : void
> 
> {
> 
> var data : ByteArray = encoder.encode( myPngByteArray );      
> 
> var params : Object = { data : base64Encode( data ) };
> 
> httpService.send( params );
> 
> }
> 
>  
> 
> In ColdFusion, you can decode the base64 data simply by using the
> "toBinary" function.  Other languages have similar functions as well.  
> 
>  
> 
> Just a FYI... using the JPG instead of PNG requires significantly less
> bandwidth & time to post the data to the server.  Base64 encoding the
> data also increases the size of the data being transferred "across the
> wire".  It is much more efficient to use a remoteObject method with
> JPG-compressed data.
> 
> _____________________________________
> 
> Andrew Trice
> 
> Cynergy Systems, Inc.
> 
> http://www.cynergysystems.com
> 
>  
> 
> Blog: http://www.cynergysystems.com/blogs/page/andrewtrice
> 
> Email: [EMAIL PROTECTED]
> 
> Office: 866-CYNERGY 

Reply via email to