Upload mp4 with progress using AFNetworking
<p>I have previously uploaded files to a presigned URL by doing the following:</p>

<pre><code>NSData *data = [NSData dataWithContentsOfURL:self.videoURL];
[self.httpSessionManager.requestSerializer setValue:@"video/mp4" forHTTPHeaderField:@"Content-Type"];
[self.httpSessionManager PUT:operation.relativeURLString parameters:@{@"data": data} success:^(NSURLSessionDataTask *task, id responseObject) {
    [self handleResponse:responseObject forSuccessfulOperation:operation];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
    [self handleError:error forFailedOperation:operation];
}];
</code></pre>

<p>But the need to track uploading progress made me change this into:</p>

<pre><code>NSData *data = [NSData dataWithContentsOfURL:self.videoURL];
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"PUT" URLString:operation.relativeURLString parameters:nil constructingBodyWithBlock:^(id&lt;AFMultipartFormData&gt; formData) {
    [formData appendPartWithFileData:data
                                name:@"data"
                            fileName:@"video.mp4"
                            mimeType:@"video/mp4"];
} error:nil];

NSURLSessionDataTask *uploadTask = [self.httpSessionManager uploadTaskWithStreamedRequest:request progress:progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
    if (!error)
    {
        [self handleResponse:responseObject forSuccessfulOperation:operation];
    }
    else
    {
        [self handleError:error forFailedOperation:operation];
    }
}];
[uploadTask resume];
</code></pre>

<p>This seems to upload the file successfully until I try to play it. It has the correct file size, but the file seems to be broken since it will not play. Am I misinterpreting how to use multipartFormRequest? I have come to understand that using NSStream or a memory mapped file instead of passing along NSData is preferable, but to my knowledge, this shouldn't be the cause of my issue, but a mere performance tweak.</p>