views:

63

answers:

1

I've have an application with Android front end and Django as the back end. As part of the answers here, I'm confused over the approach which I should take to send images to Django Server. I've 2 options at my disposal as Piro pointed out there.

1) Sending images as Multi Part entity

2) Send image as a String after encoding it using Base 64.

My knowledge in Django is limited and So I need guidance on whether which of the approaches would make it easier for the images to be processed by Django. The images are small in size (<200kb) and number (<10). Any suggestions or pointers are most welcome.

A: 

Send it as multipart. I see no benefits to using Base64 here. It just uses unnecessary time and bandwidth. HTTP is perfectly capable of safely transferring binary files. Of course, multipart is designed so you can send multiple parts, each with clearly specified mime types. So you can send one application/json part with another that's image/png.

Matthew Flaschen