Iphone图片上传 - 500错误

时间:2013-07-05 12:07:56

标签: iphone ios

我是iphone开发的新手。我想将我的设备中的图像共享到由我自己处理的服务器。我在android和iphone设备上都做过这个。它非常好地从Android发布,但每当我通过iPhone发布时,我从服务器得到500错误消息。我真的不知道我犯了什么错误。每当我与服务器通信时,是否有任何协议块iphone。

NSString *uploadUrl = [NSString stringWithFormat:@"--My url-- "];
NSURL *url = [NSURL URLWithString:uploadUrl];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSMutableString *m_strUploadedFileName = [NSMutableString stringWithFormat:@"pic_%@_%@.png",dateString,[prefs objectForKey:@"EmailId"]];

NSData *imageData = UIImageJPEGRepresentation(m_imageFish.image, 0.2);
NSLog(@"image data is %@",imageData);

[request setData:imageData withFileName:m_strUploadedFileName andContentType:@"image/jpg" forKey:@"--server parameter to send-- "];

    [request setDefaultResponseEncoding:NSISOLatin1StringEncoding];
[request setDelegate:self];
[request setRequestMethod:@"POST"];

[request startAsynchronous];

0 个答案:

没有答案