Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File upload using base64 encoded text instead of multipart/form-data - good idea?

I currently have a django formset with dynamic number of forms. Each form has a file field.

While this works, I need a way to allow multiple files to be selected at once. I can do that with input type='file' multiple='multiple' and I can read file data using FileReader. But how can I pass these files to django formset instead of form-0-file, form-1-file etc?

I can think of one way - replace FileField with TextField, and pass around the base64 encoded file as text, but I'm not sure if it's a good solution.

like image 306
tuxcanfly Avatar asked May 28 '13 13:05

tuxcanfly


1 Answers

Just use multiple attribute and use FILES to get all of uploaded files.

base64 encoding maybe not help

like image 176
Ivan Avatar answered Sep 21 '22 23:09

Ivan