title: How can I call didSendBodyData method and how to update on progress bar?
body: <ol>
  <li>How can I send byte data to another viewcontroller and use it on progressbar?</li>
  <li>How can I upload video and set progressbarview as per indexpathrow which I selected?</li>
  </ol>
  
  <p>Here is my code:</p>
  
  <pre><code>-(void)updateUserVideoResponse:(NSMutableDictionary*)params ImageFile:(NSData*)Img Completion:(void (^)(NSData *data,
  NSURLResponse *response, NSError *error))callback;
  
  {   
      NSLog(@"Params %@",params);
  
  
      NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",VideoAddResponseUrl,[params objectForKey:@"id"]]];
  
  
      // NSString *accessToken=[[AccessToken classMethodeOfAccessToken] getAccessToken];
  
      // NSData *webData = UIImageJPEGRepresentation(imageProfile,0.5);
  
  
      NSLog(@"%.2f",(float)Img.length);
  
  
      NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
      [request setURL:myURL];
      [request setHTTPMethod:@"PUT"];
  
      NSString *boundary = @"_187934598797439873422234";
  
      NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
  
  
      //  NSString *contentType = @"application/json";
  
      [request setValue:contentType forHTTPHeaderField: @"Content-Type"];
  
      NSMutableData *body = [NSMutableData data];
      [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@.mov\"\r\n",[params objectForKey:@"question"],[params objectForKey:@"question"]] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[NSData dataWithData:Img]];
  
      // [body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
  
      [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"video-size\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"%.2f",(float)Img.length] dataUsingEncoding:NSUTF8StringEncoding]];
  
      // [body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
  
      [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"camera_resolution\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
      [body appendData:[[NSString stringWithFormat:@"AVCaptureSessionPresetLow"] dataUsingEncoding:NSUTF8StringEncoding]];
  
      [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
  
      [request setHTTPBody:body];
  
      NSLog(@"Request body %@", [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding]);
  
      [request addValue:[NSString stringWithFormat:@"%lu", (unsigned long)[body length]] forHTTPHeaderField:@"Content-Length"];
  
      [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:callback] resume];
  
  }
  
  - (void)connection:(NSURLConnection *)connection
     didSendBodyData:(NSInteger)bytesWritten
   totalBytesWritten:(NSInteger)totalBytesWritten
  totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite    {
  
      float progress = [[NSNumber numberWithInteger:totalBytesWritten] floatValue];
      float total = [[NSNumber numberWithInteger: totalBytesExpectedToWrite] floatValue];
      NSLog(@"progress/total %f",progress/total);
  }
  </code></pre>