Using yfrog's uploadAndPost with Actionscript/Adobe AIR
I am trying to upload a photo from an 开发者_如何转开发Adobe AIR application to yfrog's api, http://code.google.com/p/imageshackapi/wiki/YFROGuploadAndPost. I have the following code:
public function upload(file:File, msg:String, username:String, password:String):void {
var vars:URLVariables = new URLVariables();
vars["username"] = username;
vars["password"] = password;
vars["public"] = "yes";
vars["key"] = API_KEY; //API_KEY is a constant string that holds my developer key
vars["message"] = msg;
var request:URLRequest = new URLRequest("http://yfrog.com/api/uploadAndPost");
request.method = URLRequestMethod.POST;
request.contentType = "multipart/form-data";
request.data = vars;
file.upload(request, "media");
}
When I run this code, yfrog returns 404 status. This seems to only happen if I do a media file upload with the api. If I use a "url" upload to the same api url - everything works. Has anyone else gotten a "media" file upload to work? If so, how would you change the code?
Looks like that API has been replaced as of today with the OAuth Echo method
http://code.google.com/p/imageshackapi/wiki/TwitterAuthentication
精彩评论