问题描述
根据documentation,这是限制用户可以上传的文件类型的方式:
This is how I implemented it in my code:
var myWidget = window.cloudinary.createUploadWidget(
{
cloudName: "456aefaefaefayrw",uploadPreset: "dadazf",sources: ["local"],resourceType: "image",},(error,result) => {
if (!error && result && result.event === "success") {
console.log("Done! Here is the image info: ",result.info);
}
}
);
解决方法
Cloudinary允许将pdf作为图像类型上传,而将通过image
传递的视频作为图像上传。您可以使用上载小部件中的clientAllowedFormats
选项,该选项将阻止除指定格式以外的任何其他格式上载,也可以在上载预设中提及。