I am trying to upload pdf files to Cloudinary through the widget. I assumed that I would just be able to use the same script as the regular images and videos one, but apparently it doesn't like it. when I upload the pdf, it goes through, but the url I am returned with returns no value, it is blank.
here's what I have!
<h1>Upload Documents for: <%= studentName %></h1>
<button id="upload_widget" class="button">Upload Documents</button>
<script src="https://widget.cloudinary.com/v2.0/global/all.js" type="text/javascript"></script>
<script type="text/javascript">
var myWidget = cloudinary.createUploadWidget({
cloudName: 'xxx',
uploadPreset: 'ld3l7evv'}, (error, result) => {
if (!error && result && result.event === "success") {
console.log('Done! Here is the image info: ', result.info);
console.log(result.info.secure_url)
var result_url = result.info.secure_url;
console.log("result url is " + result_url)
document.getElementById("url").value = result_url;
}
}
)
document.getElementById("upload_widget").addEventListener("click", function(){
myWidget.open();
}, false);
</script>
anyone know how to change it so I could have it working with PDF as well? Thanks :)
question from:
https://stackoverflow.com/questions/65876523/uploading-pdf-to-cloudinary 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…