Skip to content

Instantly share code, notes, and snippets.

@fel-cesar
Last active November 9, 2016 16:40
Show Gist options
  • Save fel-cesar/7c8d393036eb142bac2afd05f54eb34d to your computer and use it in GitHub Desktop.
Save fel-cesar/7c8d393036eb142bac2afd05f54eb34d to your computer and use it in GitHub Desktop.
// self.service = [[CRMicrosoftAzure alloc] initWithAccountName:@"[account_name]" accessKey:@"[access_key]"];
// self.service = [[CRAmazonS3 alloc] initWithAccessKeyId:@"[clientID]" secretAccessKey:@"[client_Secret]" region:@"[region]"];
// self.service = [[CRRackspace alloc] initWithUsername:@"[username]" apiKey:@"[api_key]" region:@"[region]"];
self.service = [[CRBackblaze alloc] initWithAccountID:@"[account_init]" appKey:@"[app_key]"];
CRBucket * bucket = [[CRBucket alloc] init];
bucket.name = @"[bucket_name]";
bucket.identifier = @"[bucket_id]";
NSData * data = //data source;
NSInputStream * inputStream = [NSInputStream inputStreamWithData:data];
@try {
[self.currentService uploadFileToBucket:bucket name:@"[file_name]" withStream:inputStream size:data.length];
} @catch (NSException *exception) {
//handle exception
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment