Upload File to B2.

Share:

Description

b2Uploadfile Uploads one file to the user's account B2.

Usage

1
b2UploadFile(authToken, uploadUrl, fileName)

Arguments

authToken

A unique authorisation token permiting the upload of files to B2. An authorisation token is obtained from b2UploadUrl.

uploadUrl

A unique URL permiting the upload of files to B2. An upload URL is obtained from b2UploadUrl.

fileName

The name of the file to be uploaded. Files must be located in the current working directory. A complete list of supported file types may be found in the b2FileTypes.rds file located in this package's data directory, or at the following location: https://www.backblaze.com/b2/docs/content-types.html

Details

This function uploads one file to the user's account on the Backblaze B2 cloud storage product, returning a unique file ID. Files cannot be uploaded to B2 unless GetUploadUrl has been executed first, specifying the bucket in which to upload the file. Further details regarding this API call are available here:

https://www.backblaze.com/b2/docs/b2_upload_file.html

authToken, uploadUrl and fileName are mandatory and must be user defined.

Value

If successful a list containing the fileId, fileName, accountId, bucketId, contentLength, contentSha1, contentType and fileInfo will all be echoed back to the user.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Make a bucket Private
# Get Upload URL
uploadUrlReturn <- b2GetUploadUrl(bucketId = "aUniqueBucketId")
uploadUrl <- uploadUrlReturn$uploadUrl
authToken <- uploadUrlReturn$authorizationToken
# Upload file
b2UploadFile(authToken, uploadUrl, fileName = "yourFileName.png")

## End(Not run)