Python Flask Basics Welcome to Flask Introduction

Roopak A N
Roopak A N
5,372 Points

Multiple File Upload with AJAX in Flask


I have been trying to work out multiple file uploads in flask using ajax. I couldn't even make out for single file upload. The ajax post method fails.

I found an alternative flask-sijax but there too multiple uploads are not supported.

Tried all parameter resets , async:false,contentType:false, seems like ajax-flask not working if content type is not set but what to do when with file uploads?

If any solution, do mention how to access multiple files sent using ajax.

formdata() method too not working..

Tried googling a lot. No use.

Thank You


1 Answer

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

It's been a long time since I've done file uploads but you're sending the form as multipart, right? And I think you have to check request.FILES for the binary data.