Using file:
file: UploadFile = File(...)
I try to put the file-like object into an s3 bucket:
s3_response = s3.Bucket(bucket_name).put_object(Key=file.filename, Body=file)
i get the error:
start_position = fileobj.tell()
AttributeError: 'UploadFile' object has no attribute 'tell'
I'm assuming i need to either implement tell(), or convert to a bytes
Would there be other options?
And if so, how you recommend into converting UploadFile into a bytes efficiently?
UploadedFile has a member file which might help. So instead of using s3_response = s3.Bucket(bucket_name).put_object(Key=file.filename, Body=file) it might help using s3_response = s3.Bucket(bucket_name).put_object(Key=file.filename, Body=file.file)
that worked, thank you
Thanks for the help here @merowinger92 ! :bowing_man: :cake:
Thanks for reporting back and closing the issue @joeraygme :+1:
Most helpful comment
UploadedFilehas a memberfilewhich might help. So instead of usings3_response = s3.Bucket(bucket_name).put_object(Key=file.filename, Body=file)it might help usings3_response = s3.Bucket(bucket_name).put_object(Key=file.filename, Body=file.file)