How to upload a BitmapData Object straight to my server?

前端 未结 6 479
北海茫月
北海茫月 2020-12-18 08:14

I wish to upload from my Flash Application (AS3) to imageshacks XML API. I wish to know how I can do this.

\"In Flash, we must POST the data using the UrlRequest and

6条回答
  •  春和景丽
    2020-12-18 08:28

    This was of great help to me: http://kitchen.braitsch.io/upload-bitmapdata-snapshot-to-server-in-as3/

    You need to modify the URLRequestWrapper to insert field names and file names where needed. Here's what I've done:

    bytes = 'Content-Disposition: form-data; name="' + $fieldName + '"; filename="';
    

    It does the most formatting of headers so the server could understand it as a file upload.

    By the way, if you have a BitmapData you might need to encode it to JPEG or PNG first.

    Regards, Artem

提交回复
热议问题