3
votes

I've done some looking at the Cloudinary API and upload examples for NodeJS, and it looks like the server-side uploads use a file path. Meanwhile, the client-side uploads require a frontend input tag. I already have a frontend for users to select and crop a picture to their liking, and this gives me a data URI. I'd like to save this file to Cloudinary without having to use their built in frontend option. Is this possible? This would basically mean that I would be able to call some kind of upload function that can take a URI or file blob.

1

1 Answers

7
votes

Cloudinary supports uploading files using a data-URI encoded string too. Please make sure that you send your content as a Data-URI as explained here: http://en.wikipedia.org/wiki/Data_URI_scheme.

For example, in Node.js:

cloudinary.uploader.upload("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", function(result) {console.log(result)});