amazon-web-servicespython-2.7amazon-s3flask-admin

Upload Image to Amazon S3 with Flask-admin


I am using Flask-Admin and is very happy with it. However, the sample in Flask-Admin only provides to upload the image to static folder. Is it possible to upload it to S3 directly with Flask-Admin? Thanks.

Regards Alex


Solution

  • Thanks for your sample code, Alex Chan. I needed this functionality too, so I decided to write more complete S3FileUploadField and S3ImageUploadField classes, based on your code and various other snippets.

    You can find my code at:

    https://github.com/Jaza/flask-admin-s3-upload

    Also up on pypi, so you can install with:

    pip install flask-admin-s3-upload

    I've documentated a basic usage example in the readme (can see it on the github project page). Hope this helps, for anyone else who needs S3 file uploads in flask-admin.