【问题标题】:Dropzone - auto remove thumbnail of non acceptedFilesDropzone - 自动删除未接受文件的缩略图
【发布时间】:2016-03-23 05:40:54
【问题描述】:

我已应用以下设置:

acceptedFiles: "image/jpeg, image/jpg, image/png, image/gif",

不排除其他文件但缩略图不会自动删除,我也想删除缩略图。

目前,dropzone 对不接受的文件给出以下错误:You can't upload files of this type.

我不想显示该消息,而只是从放置区域中删除该缩略图。

谁能告诉我,我怎样才能达到同样的效果?

【问题讨论】:

    标签: javascript jquery dropzone.js


    【解决方案1】:

    试试这个:

              init: function() {
                    this.on("addedfile", function (file) {
                        var _this = this;
                        if ($.inArray(file.type, ['image/jpeg', 'image/jpg', 'image/png', 'image/gif']) == -1) {
                            _this.removeFile(file);
                        }
                    });
                }
    

    【讨论】:

      猜你喜欢
      • 2017-03-21
      • 2021-06-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-12
      • 2021-04-06
      • 1970-01-01
      • 2016-11-11
      • 1970-01-01
      相关资源
      最近更新 更多