Loading a multiple image using Django Rest Framework in a single POST array?

Good afternoon, I have a problem using DRF to get multiple images in the same column as an array.

I read a lot about this topic, the most common solution is to encode this line, but this is not the approach that I want, because I take a lot of resources that we don’t have.

Another, most common one that uses DRF to request a method for Parsing a header in a content type. http://www.django-rest-framework.org/api-guide/parsers/#how-the-parser-is-determined But if I'm right, this uses the multipart / form-data method for this.

In fact, I want it to simply receive data in Json Array, this is using the build mobile app in appcelerator, where the user sends an array of images.

I would be glad if someone answers me, if possible, because all the information I found indicates only multipart / form-data.

By the way, you can upload one file, but not a multiple, I did this with this:

ukeys = request.FILES ['fotos']

Thank you for your time.

+2
source share
1 answer

In fact, I want it to simply receive data in Json Array, this is using the build mobile app in appcelerator, where the user sends an array of images.

You will need to check the basic request and find out exactly what is sent to the wire. JSON does not support the file primitive, so the "image array" is likely to be an array of strings with some encoding.

request.FILES [ '']

request.FILES.getlist('fotos').

+2

Source: https://habr.com/ru/post/1570038/


All Articles