title: Full Quality For Video Upload
body: <p>Im picking a video from UIImagePicker, the video is then being uploaded to my server. I want the quality of the video to remain the same. As of right now the video has a bit less quality compared to the one i took directly off my phone, and it is a smaller resolution.</p>
  
  <p>here is my code:</p>
  
  <pre><code>-(IBAction)video:(id)sender{
  UIImagePickerController *picker = [[UIImagePickerController alloc] init];
  picker.delegate = self;
  picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  picker.mediaTypes =  [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
  picker.allowsEditing = YES;
  picker.wantsFullScreenLayout = YES;
  picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
  [self presentModalViewController:picker animated:YES];
  }
  
  
  
  - (NSData *)generatePostDataForData:(NSData *)uploadData
  {
  // Generate the post header:
  NSString *post = [NSString stringWithCString:"--AaB03x\r\nContent-Disposition: form-data;     name=\"upload[file]\"; filename=\"somefile\"\r\nContent-Type: application/octet-stream\r\nContent-Transfer-Encoding: binary\r\n\r\n" encoding:NSASCIIStringEncoding];
  
  // Get the post header int ASCII format:
  NSData *postHeaderData = [post dataUsingEncoding:NSASCIIStringEncoding  allowLossyConversion:YES];
  
  // Generate the mutable data variable:
  NSMutableData *postData = [[NSMutableData alloc] initWithLength:[postHeaderData length] ];
  [postData setData:postHeaderData];
  
  // Add the image:
  [postData appendData: uploadData];
  
  // Add the closing boundry:
  [postData appendData: [@"\r\n--AaB03x--" dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
  
  // Return the post data:
  return postData;
  }
  
  - (void)post:(NSData *)fileData
  {
  
  NSData *videoData = fileData;
  NSString *urlString = @"http://www.site.com/scripts/upload.php";
  
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  [request setURL:[NSURL URLWithString:urlString]];
  [request setHTTPMethod:@"POST"];
  
  NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
  NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
  [request addValue:contentType forHTTPHeaderField:@"Content-Type"];
  
  NSMutableData *body = [NSMutableData data];
  [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
  [body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"userfile\"; filename=\".mov\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
  [body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
  [body appendData:[NSData dataWithData:videoData]];
  [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
  [request setHTTPBody:body];
  
  NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
  NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
  
  NSLog(@"%@", returnString);
  }
  
  
  - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ 
  [self dismissModalViewControllerAnimated:YES];
  //assign the mediatype to a string 
  NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
  
  //check the media type string so we can determine if its a video
      NSLog(@"got a movie");
      NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
      NSData *webData = [NSData dataWithContentsOfURL:videoURL];
      [self post:webData];
  
  
  }
  </code></pre>
  
  <p>setting the pickers quality to high i thought would do it, i guess not. I have the option to export in 720p, but i want iphone 4s's to upload in full 1080p.</p>
  
  <p>Any help would be great. Thanks :D</p>