0

I've got a template that works nicely with synchronous submission. I've got a couple of images that I'm trying to upload with the form, having resized them in the browser to the desired size in a <canvas>. I could append these to a FormData object, but I'm trying to avoid asynchronous submission because I'd really like to reprocess the template through the django template context processor (for various reasons).

Is it possible to get my binary image data in the form, submit synchronously, and still be "recognisable" as a request.FILES object server side? If so, how do I do this?

Escher
  • 5,418
  • 12
  • 54
  • 101
  • Probably sending it as a base64 encoded string inside a hidden field is your best bet, then manually decode and save to a file on a server side http://stackoverflow.com/a/13199011/20128 – serg Dec 21 '16 at 04:07
  • Thanks, that's what I'll do. The js is simple and I'll post the python image validation code when I write it. – Escher Dec 21 '16 at 07:39

0 Answers0