Here i am Getting image path ,i am converted the path as nsdata ,but in server side receiving empty ...
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//You can retrieve the actual UIImage
_signupImgView.image = [info valueForKey:UIImagePickerControllerOriginalImage];
//Or you can get the image url from AssetsLibrary
NSURL *path = [info valueForKey:UIImagePickerControllerReferenceURL];
imageSending=[UIImage imageWithData:[NSData dataWithContentsOfURL:path]];
imgdata = UIImagePNGRepresentation(imageSending);//here i am converting as nsdata...
[picker dismissViewControllerAnimated:YES completion:^{
}];
}
This is my post code
-(void)signupScreen:(NSString *)firstName :(NSString *)emailID :(NSString *)phoneNumber :(NSString *)password :(NSData *)img
{
NSString *strSignupScreenRequest=[NSString stringWithFormat:@"firstname=%@&email=%@&telephone=%@&password=%@&pic=%@""%@",firstName,emailID,phoneNumber,password,img];
NSData *dataFetch=[strSignupScreenRequest dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:localRegister]];
[self requestFunction:url :dataFetch:NO];
}
This is my post method assigned globally....
else
{
[request setURL:url];
[request setHTTPMethod:@"POST"];
NSString *conLength=[NSString stringWithFormat:@"%lu",(unsigned long)data.length];
[request setValue:conLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:data];
NSLog(@"post method ===%@",request);
}
i have seen most of the people say AFNETWORKING is good way in that many file is there i don't know how to achieve please any one guide me....