使用yfrog的uploadAndPost和Actionscript / Adob​​e AIR

时间:2010-05-08 19:37:02

标签: actionscript-3 air yfrog

我正在尝试将照片从Adobe AIR应用程序上传到yfrog的api,http://code.google.com/p/imageshackapi/wiki/YFROGuploadAndPost。我有以下代码:

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");
}

当我运行此代码时,yfrog返回404状态。这似乎只有在我使用api上传媒体文件时才会发生。如果我使用“url”上传到相同的api网址 - 一切正常。有没有其他人上传“媒体”文件?如果是这样,您将如何更改代码?

1 个答案:

答案 0 :(得分:0)

使用OAuth Echo方法看起来已经替换了今天的API

http://code.google.com/p/imageshackapi/wiki/TwitterAuthentication