【问题标题】:Cloudinary widget: Setting resource type does not limit the type of files the user can uploadCloudinary 小部件:设置资源类型不限制用户可以上传的文件类型
【发布时间】:2020-12-10 01:59:00
【问题描述】:

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

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

【问题讨论】:

    标签: html css reactjs cdn cloudinary


    【解决方案1】:

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

    【讨论】:

    • 这很奇怪。谢谢你。它解决了我的问题/
    猜你喜欢
    • 2012-01-19
    • 2010-12-16
    • 1970-01-01
    • 2014-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多