Hi,,

I have a bitmap data on a canvas that I want to save as an Image on the
Server.
Can you tell me what's wrong with the following code:
I have an UploadHandler file *(UploadHandler.aspx)* that is found to be
working in case the User selects a file from his PC (using browse method).
But in this case, we need to convert the BitMapData into a File or Bytes
before passing to UploadHandler.
Thanks in advance,

//
=========================================================================================
//

*var* bd:BitmapData = ImageSnapshot.captureBitmapData(source,*null*,*null*,*
null*,*null*,*true*); //This is the reference BitMapData

*
**var* request:URLRequest ;

request = *new* URLRequest(*"UploadHandler.aspx?str=Image"*+*
"&image_name=Disco"*);*//sFontName
*

request.contentType = *"application/octet-stream"*;

request.method = URLRequestMethod.POST;

*var* pngEncoder:PNGEncoder=*new* PNGEncoder();*//ask the user to save the
file

*

fileReference.addEventListener(ProgressEvent.PROGRESS, progressStatus);

fileReference.addEventListener(Event.COMPLETE, onUploadComplete);

fileReference.addEventListener(IOErrorEvent.IO_ERROR, onIOError);

fileReference.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
onUploadSecurityError);

*var* ba:ByteArray = PNGEncoder.encode(bd);

fileReference = FileReference(ba);

fileReference.upload(request,fileReference.name,*false*);
//
=========================================================================================
//

Thanks,
Rahul

-- 
"Learning is not necessary, neither is survival"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to