Can any body help me how to select video and image both at the same time in iphone app programmatically through JSON?
Here is my code:
urlString = [NSString stringWithFormat:@"%@",@"http://millioninone.cisusa.net/rest/index.php?c=save&m=savevideo"];
NSLog(@"%@",urlString);
//urlString=[urlString stringByAppendingFormat:@"product.php?strJSON="];
NSString *filename = @"postVideo";
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSMutableData *body = [NSMutableData data];
NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request addValue:contentType forHTTPHeaderField:@"Content-Type"];
// if(imagedatabool)//ye image data ka object h jisme image jati h agar tujhe image nahi bjhna h to ye rehne dena
// {
NSString *str=@"/Users/CIS1/Library/Application Support/iPhone Simulator/4.3/Media/DCIM/100APPLE/IMG_0042.MP4";
videoData=[NSData dataWithContentsOfFile:str];
// add the image form fields
// NSData *imageData = UIImagePNGRepresentation(imgView.image);
//NSLog(@"%@",imageData);
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];