title: NSURLSession background uploading huge files
body: <p>I am trying to upload a large file 2GB in the background using <code>NSURLSessionUploadTask</code>. The service uses multipart format, so in order to upload it in the background i am creating a temporary file with the Body of the request, then i am using a uploadTask to schedule the upload and when the files finishes uploading i am deleting the temporary file.</p>
  
  <p><code>NSURLSessionUploadTask  *uploadTask = [[self backgroundNSURLSession] uploadTaskWithRequest:uploadRequest fromFile:filePath];
  [uploadTask resume];</code></p>
  
  <p>With files smaller then 1.4 GB the upload worked ok, but when I try to upload video files of 2 GB, the upload fails. Server is returning error message that i did not attached the file.</p>
  
  <p>I am refactoring the upload component from ASIHTTP to NSURLSession if i do the upload with ASIHTTP it works even for large files.</p>
  
  <p>This is how i create my NSURLSession:</p>
  
  <pre><code> if ([NSURLSessionConfiguration respondsToSelector:@selector(backgroundSessionConfigurationWithIdentifier:)]) {
          self.configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:appID];
      } else  {
          self.configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:appID];
      }
      self.configuration.HTTPMaximumConnectionsPerHost = 1;
      self.configuration.discretionary = YES;
      self.configuration.timeoutIntervalForResource = 60*60;
      self.configuration.timeoutIntervalForRequest  = 60*60;
      backgroundSession = [NSURLSession sessionWithConfiguration:self.configuration delegate:self delegateQueue:nil];
  </code></pre>
  
  <p>So the problem is only for large files, for small files the upload is performed. Has anyone else encountered the same problem?</p>