I am using Backblaze B2 and b2sdk.v2 in Flask to upload files.
This is code I tried, using the upload
method:
# I am not showing authorization code...
def upload_file(file):
bucket = b2_api.get_bucket_by_name(bucket_name)
file = request.files['file']
bucket.upload(
upload_source=file,
file_name=file.filename,
)
This shows an error like this
AttributeError: 'SpooledTemporaryFile' object has no attribute 'get_content_length'
I think it's because I am using a FileStorage
instance for the upload_source
parameter.
I want to know whether I am using the API correctly or, if not, how should I use this?
Thanks