简体   繁体   English

如何使用jquery将pdf上传到“ cloudinary”并检索该pdf的链接?

[英]How to upload a pdf to “cloudinary” using jquery and retrieve the link to that pdf?

I have generated a PDF from itextpdf , now I want to upload this PDF file to "cloudinary" and save the link of uploaded portable document file in database. 我已经从itextpdf生成了一个PDF,现在我想将此PDF文件上传到“ cloudinary”,并将上传的可移植文档文件的链接保存在数据库中。 I can use both jquery and java for this purpose. 我可以同时使用jquery和java。 I think that "cloudinary" returns json data and link can be taken from this json data? 我认为“ cloudinary”返回json数据,可以从此json数据中获取链接吗?

Using Cloudinary's Java library, something like this should be what you're looking for: 使用Cloudinary的Java库,您要找的东西应该是这样的:

import com.cloudinary.Cloudinary;

Cloudinary cloudinary = new Cloudinary();
Map response = cloudinary.upload("my_file.pdf", ObjectUtils.asMap("resource_type", "raw"));
String url = (String) response.get("url");
// Add url to database

Regarding configuration parameters for secure API calls 关于安全API调用的配置参数

Doing it manually is more involved (sans Cloudinary's libary), but I can take you through it if you'd like. 手动执行此操作比较麻烦(没有Cloudinary的libary),但是如果您愿意,我可以指导您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM