我想将图像从我的 iPhone 发送到服务器(.net)
在 iPhone 端,我用这种方法发送图像:
UIImage *myImg = ((UserData*)[UserData sharedUserData]).image;
NSData *imageData = UIImageJPEGRepresentation(myImg, 0.5);
imageRequest = [ASIFormDataRequest requestWithURL:url];
[imageRequest addData:imageData withFileName:@"someFileName.jpeg" andContentType:@"image/jpeg" forKey:@"uploadedImage"];
[imageRequest setDelegate:self];
[imageRequest setRequestMethod:@"POST"];
[imageRequest startAsynchronous];
在服务器端这是:
string input = null;
using (StreamReader sr = new StreamReader(Request.InputStream))
{
input = sr.ReadToEnd();
}
Response.Write(input);
return;
然后当我打印input
我得到:
--0xKhTmLbOuNdArY-62D4D088-0CE1-4D32-BE57-2ED976BDF9FE
Content-Disposition: form-data; name="uploadedImage"; filename="someFileName.jpeg"
Content-Type: image/jpeg
����
现在我的问题是我无法将图像保存到服务器的磁盘中,我在任何地方都没有找到答案。