DRF Upload multiple files

1,677 views
Skip to first unread message

Maxus Lord

unread,
May 16, 2016, 5:37:01 PM5/16/16
to Django REST framework

Good day everyone, I have a problem using DRF for getting multiples images in a single Post with an array.

I have read a lot about this topic, the most common solution is to encode64 the string, but is not an approach that I want because take a lot of resource that we don't have.

The other one, is the most common that DRF use, to request method to Parse the header in the content type. http://www.django-rest-framework.org/api-guide/parsers/#how-the-parser-is-determined


But if I'm correct, this use a multipart/form-data way to do it.

The really one that I want, is a way to do it just receiving the data in a Json Array, this is by using a mobile app build in appcelerator where the user sends an array of images.

I would be glad if someone answer me if at least is possible, because all the information that I have found only point to multipart/form-data.

By the way, is possible to upload a single file, but not multiples, I have done it with this:


ukeys = request.FILES['fotos']


Thanks for your time.

Andrew Backer

unread,
May 16, 2016, 11:08:12 PM5/16/16
to django-res...@googlegroups.com
A quick google turned up a few examples.  I happened to know one of them was there already, but I've never used it:

https://github.com/Hipo/drf-extra-fields

The others take a little more work to use, depending on your version of DRF, so try that one first.   Maybe putting it into a ListField would work.  Beware of the request size though.

~ Andrew
May 17, 2016 at 5:37 AM
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sent from Postbox
Reply all
Reply to author
Forward
0 new messages