I am using a synchronous request to send an image as hexa string to a server. I am not able to hit the server if I send hexa string of images of resolution 200×150 but I am able to get response from server if send the same image at a lower resolution like 100×75.
NSMutableString *urlString = [NSMutableString stringWithString:@"http://xxxxxx:8080/GeoLocationSave/ReceiveImage"];
UIImage *sample = [UIImage imageNamed:@"ip_addphoto_100x75@2x.png"];
NSData *imgData = UIImagePNGRepresentation(sample);
[urlString appendString:@"?image="];
[urlString appendString:hexImage];
NSError *error;
error=nil;
NSURLResponse *response;
response=nil;
NSURL *url = [NSURL URLWithString:urlString];
NSData *urlData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] returningResponse:&response error:&error];
The length of urlData is 0 for a higher resolution image. Log value of imageData for both images are perfect. I don’t see any entry point log in server for higher resolution image.
Hi guys i found what mistake i was making. I was too ridiculous to push data as large as 8000 bytes through HTTP Get method. I noted that if the url length is greater than 8000 bytes it doesn’t hit the server. So i just moved over to HTTP POST method as in case if image taken through camera (which can can easily get past the 8000 bytes length) is to be sent to server it wouldn’t hit the server.