FileResponse
is used specifically for uploading a file as a response (hence the path argument). In you're case you want to base64-encode the file before uploading it. This means no FileResponse
.
Since you've read the file into memory you can just upload the content in a Response
.
response = Response(encoded_string,
request=request,
content_type=sContentType+';base64')
I'm not actually sure how content_encoding
compares to the ;base64
on the type, but I think the encoding is used more commonly for gzipped content. YMMV.