helloflask / helloflask/flask-dropzone
Upload failures when using upload on click
- Dominant language
- Python
- Stars
- 246
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
I'm using dropzone in a flask application that uploads files to AWS S3. I have the following configuration for the dropzone:
```
app.config.update(
DROPZONE_MAX_FILES=10,
DROPZONE_PARALLEL_UPLOADS=3,
DROPZONE_UPLOAD_MULTIPLE=True,
DROPZONE_ALLOWED_FILE_CUSTOM=True,
DROPZONE_MAX_FILE_SIZE=10000,
DROPZONE_ALLOWED_FILE_TYPE=".xls, .xlsx, .csv, .doc, .rtf",
DROPZONE_DEFAULT_MESSAGE="
Drag files here or click to select",
DROPZONE_UPLOAD_ON_CLICK=True,
DROPZONE_UPLOAD_BTN_ID="upload_button",)
```
I notice that with this method, if a single file fails the upload (for ex, if the file is of the wrong type) none of the files are uploaded. The behavior that I would expect is that all of the other files continue to upload and only the single file that fails the file extension test does not upload. Below is the code for upload function in the flask application:
```
def upload():
if request.method == "POST":
for key, file in request.files.items():
if key.startswith('file'):
# Save file locally
if not os.path.exists(tmp_folder_path):
os.mkdir(tmp_folder_path, 0o777)
file.save(os.path.join(tmp_folder_path, file.filename))
return render_template("index.html")
```
I'm using Python 3.7.4 with the following packages:
boto3==1.16.11
botocore==1.19.11
click==7.1.2
Flask==1.1.2
Flask-Dropzone==1.5.4
itsdangerous==1.1.0
Jinja2==2.11.2
jmespath==0.10.0
MarkupSafe==1.1.1
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.15.0
urllib3==1.25.11
Werkzeug==1.0.1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.