Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Welcome to Flask Introduction

Roopak A N
Roopak A N
5,373 Points

Multiple File Upload with AJAX in Flask

Hi,

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

Cheers

1 Answer

Kenneth Love
STAFF
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.