最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Upload image URI to Cloudinary - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked Dec 23, 2014 at 6:47 ritmatterritmatter 3,5184 gold badges26 silver badges43 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

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/wiki/Data_URI_scheme.

For example, in Node.js:

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

发布评论

评论列表(0)

  1. 暂无评论