Learn R Programming

backblazer (version 0.1.0)

b2UploadFile: Upload File to B2.

Description

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

Usage

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

Value

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

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.

Examples

Run this code
## 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)

Run the code above in your browser using DataLab