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 NIMAGES
as:
NIMAGES = tuple('JPG jpg jpe jpeg png gif svg bmp'.split()) photos = UploadSet('photos', NIMAGES)
TO-DO - Pop-up error message
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 inflask_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 NIMAGES
as:
NIMAGES = tuple('JPG jpg jpe jpeg png gif svg bmp'.split()) photos = UploadSet('photos', NIMAGES)
Which works.
To do -
- 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.