以下のコードを使用して、画像をサーバーにアップロードします。iosの画像のアップロードタイムアウトエラー
NSString *url = [NSString stringWithFormat:@"http://192.250.1.52:xxx/api/user/profileUploadUser?userid=27&[email protected]"];
NSMutableDictionary *jsonDict = [[NSMutableDictionary alloc]init];
[jsonDict setObject:ImageToUpload forKey:@"file"];
////////ImageToUpload = /var/mobile/Containers/Data/Application/89112E0B-C1D6-4408-8586-6C5B4A431713/Documents/61.png
[manager POST:url parameters:jsonDict
success:^(AFHTTPRequestOperation *operation, id responseObject)
{ //////success code }
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Image upload" message:@"failure" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
NSLog(@"error message %@",error);
// handle failure
}];
それは、常に故障ブロックに入ると は、エラーメッセージが表示されます。
エラーメッセージ: " がタイムアウト要求" エラードメイン= NSURLErrorDomainコード= -1001 のUserInfo = {NSErrorFailingURLStringKey = http://192.250.1.52:xxxx/api/user/profileUploadUser?userid=27&[email protected]、_kCFStreamErrorCodeKey = -21022}}}
画像をサーバーにアップロードするためのマルチフォームデータを使用 –
マルチフォームデータを使用して画像のファイルパスを送信することは可能ですか? – Lenin
ファイルパスは動的ですが、どのように同じファイルを展開しますか –