尝试发布带有其他数据的图像。
IOS代码:
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:userID forKey:@"userid"];
[params setValue:sessionID forKey:@"sessionid"];
CWNetworkOperation *operation = [self operationWithURL:url httpMethod:@"POST" params:params];
NSData *imageData = UIImageJPEGRepresentation(image, 0.8f);
[operation setData:imageData forKey:@"photo" mimeType:@"image/jpeg" fileName:@"image.jpg"];
可以将 userid 和 sessionid 添加为 org.apache.http.NameValuePair
到 org.apache.http.client.methods.HttpPost,但添加编码为 base64 字符串图像字节数组值的“照片”键不会给出肯定的结果。
嗅探器屏幕:
如何在java中做同样的事情?