从ios7 app上传Zip文件

时间:2014-03-14 15:28:55

标签: ios7 upload zip afnetworking-2

我尝试上传到基于soap的webservice zip文件,我想使用AFNetworking 2.0

我的代码:

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];


[manager POST:urlString parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
    //
    [formData appendPartWithFileData:[NSData dataWithContentsOfFile:zipPath] name:@"FILE" fileName:@"DocumentsZippedLogs.zip" mimeType:@"application/zip"];
} success:^(NSURLSessionDataTask *task, id responseObject) {
    NSLog(@"succes");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
    NSLog(@"fail %@", error);
}];

和我的错误:

Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: unsupported media type (415)" UserInfo=0x8edd240 {NSErrorFailingURLKey=my url here, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x8d9a830> { URL: http://10.233.208.10:8072/Service.svc } { status code: 415, headers {
"Content-Length" = 0;
Date = "Fri, 14 Mar 2014 15:18:50 GMT";
Server = "Microsoft-IIS/7.5";
"X-Powered-By" = "ASP.NET";

}},NSLocalizedDescription =请求失败:不支持的媒体类型(415)}

你告诉我有什么问题吗?

感谢您的帮助 最好的Tomek:)

0 个答案:

没有答案