NSDeveloper
NSDeveloper

Reputation: 1640

How to upload file(>64M) to azure blob storage[iOS]

I'm using WAToolkit to add blob to container,but when upload big file it will generate the error:Error Domain=com.microsoft.WAToolkit Code=413 "The request body is too large and exceeds the maximum permissible limit.".The remarks section of the doc indicates the maximum upload size for a block blob is 64 MB. The app may also receive memory warning.

    NSString *blobName = @"IMG_0242.MOV";
    WABlob *blob = [[[WABlob alloc] initBlobWithName:blobName  URL:nil containerName:self.selectedContainer.name] autorelease];
    NSString *filePath = [[NSBundle mainBundle]pathForResource:blobName ofType:nil];
    blob.contentData = [[NSData alloc]initWithContentsOfFile:filePath];
    [[NSOperationQueue mainQueue]addOperationWithBlock:^{
        [storageClient addBlob:blob
                   toContainer:self.selectedContainer
         withCompletionHandler:^(NSError* error) {
             if(error) {
                 NSLog(@"error:%@",error);
                 return;
             }
         }];
    }];

How to change the code or use other method to solve the problem?

Upvotes: 0

Views: 1732

Answers (1)

Related Questions