Sacchid / UploadImg

Flask - upload images & display them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upload Images & Display them using Flask & Flask-Dropzone

Implementation of Medium Article: Upload multiple images with Python, Flask and Flask-Dropzone

In order to handle .JPG as well as .jpg, I have declare custom NIMAGESas:

NIMAGES = tuple('JPG jpg jpe jpeg png gif svg bmp'.split()) photos = UploadSet('photos', NIMAGES)

TO-DO - Pop-up error message


About -

While going through following medium article: Upload multiple images with Python, Flask and Flask-Dropzone , I got UploadNotAllowed error for .JPG images.

(Uppercase .JPG, no error for lowercase .jpg images)

GitHub links - GitHub link of medium article , GitHub link of my implementation


In order to restrict uploads to images,UploadSet('photos', IMAGES) was used

where, IMAGES are defined in flask_upload.py as :

IMAGES = tuple('jpg jpe jpeg png gif svg bmp'.split())


So, In order to handle .JPG as well as .jpg, I have declare custom NIMAGESas:

NIMAGES = tuple('JPG jpg jpe jpeg png gif svg bmp'.split()) photos = UploadSet('photos', NIMAGES)

Which works.


To do -

  1. While handling UploadNotAllowed error in exception, I tried to use flask_toastr to display pop-up: Wrong Image Type, but with Status code 302, it was re-directed to homepage without showing pop-up.

About

Flask - upload images & display them.


Languages

Language:Python 80.4%Language:HTML 19.6%