我正在尝试将 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 url - 一切正常。有没有其他人可以上传“媒体”文件?如果是这样,您将如何更改代码?