I am running a python Flask app on Heroku and trying to write a new function that takes user input from a textarea then upload to AMS s3 as a plain text document. The application should have a function that retrieves the file and show it to the user.
After some reading on the boto3 docs I found that the upload_to_s3 (or similarly named) functions would take file like objects. I am not aware how JS could handle files on the frontend so the only way I could think of is:
- grab the user input with
request.form.get() - cast into a
bytearrayand create a tmp file by callingmktempin python - upload the file to s3 and then delete the tmp file
However I’m aware that this is stupid way as it would be not scalable with handling these files at the backend.
Is there a frontend/JS way to do it?
Aucun commentaire:
Enregistrer un commentaire