1

I'm trying to find out if the Fine Uploader can limit the total amount of images allowed. So lets say I'd like to limit the images to 5 and a user drag and drops or selects 6 images it will prompt the user saying that can't be done due to only allowing a maximum of 5 images.

I've been looking at the documentation but I might have missed it.

4

1 回答 1

6

更改validation.itemLimit选项以匹配您要添加的最大文件数,更改validation.acceptFilesvalidation.allowedExtensions以仅匹配图像文件(验证文档

var uploader = new qq.FineUploader({
    /* ... */
    validation: {
         itemLimit: 5,
         acceptFiles: 'image/*',
         allowedExtensions: ['.jpe', '.jpg', '.jpeg', '.gif', '.png', '.bmp', '.ico', '.svg', '.svgz', '.tif', '.tiff', '.ai', '.drw', '.pct', '.psp', '.xcf', '.psd', '.raw']
    }
});

注意:如果您想要自定义错误消息,请将messages.tooManyItemsError选项的文本更改为您想要的特定错误消息(错误处理文档)。您还可以将代码添加到 onError 回调以自定义显示消息的方式和时间(事件文档)或执行一些其他操作。

于 2013-08-21T16:29:22.277 回答