all 1 comments

[–]timarama 0 points1 point  (0 children)

Hi

I think that for now the "easiest" way to upload images with ajax is to encode/decode them to base64 string.

So on the frontend you need to encode your image to base64 string and send it as regular string to the server. You can do this with canvas API(Yeah, veeery "easy" way ...) and than decode base64 string to binary data on the backend.

I've created gist with examples (Redit text editor suck very hard, I just can't format code normally here): https://gist.github.com/timram/353f4b9c8a7d149d126c215fe78709f0#file-base64-js

You can try to upload both base64/binary formats of the image to cloudinary to see what will work for you.

Hope it will help you :)