Last active
December 31, 2015 01:09
-
-
Save mani95lisa/7912530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ActionScript3 upload file to qiniu.com | |
var u:URLRequest=new URLRequest('http://up.qiniu.com'); | |
u.method=URLRequestMethod.POST; | |
u.requestHeaders=[new URLRequestHeader('enctype', 'multipart/form-data')]; | |
var ur:URLVariables=new URLVariables(); | |
ur.key='Your file name in qiniu.com'; | |
ur.token='Your uptoken from server'; //Only this is required | |
ur['x:param'] = 'Your custom param and value'; | |
u.data=ur; | |
f.upload(u, 'file'); //File or FileReference is both OK, but UploadDataFieldName must be 'file' | |
f.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadedHandler); | |
protected function uploadedHandler(event:DataEvent):void | |
{ | |
trace(event.data); //{"hash":"File hash info","key":"Uploaded file name", "x:param":"Your custom param and value"} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment