我一直试图将相机图像从iPhone上传到我的网络服务器,但有些图像是如何在病房后改变它的方向.这只发生在相机图像上,而不是从我的机器上传到设备的简单图像.
以下是代码:
NSData *imgdataRepresentation = UIImageJPEGRepresentation(imgTemp, 0.5);
///////**********************************************
// setting up the URL to post to
NSString *addPhotoURL = [NSString stringWithFormat:@"%@%@%@",HTTP_HOST,ADD_PHOTO_URL,[userInfo.userDetail objectForKey:@"id"]];
// setting up the request object now
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:addPhotoURL]];
[request setHTTPMethod:@"POST"];
/*
add some header info now
we always need a boundary when we post a file
also we need to set the content type
You might want to generate a random boundary.. this is just the same
as my …Run Code Online (Sandbox Code Playgroud)