Cloudinary小部件:设置资源类型并不限制用户可以上传的文件类型

问题描述

根据documentation,这是限制用户可以上传的文件类型的方式:

enter image description here

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);
      }
    }
  );

但是,用户仍然可以看到 ALL 类型的文件:

enter image description here

解决方法

Cloudinary允许将pdf作为图像类型上传,而将通过image传递的视频作为图像上传。您可以使用上载小部件中的clientAllowedFormats选项,该选项将阻止除指定格式以外的任何其他格式上载,也可以在上载预设中提及。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...