如何覆盖jQuery fileupload插件选项

3
我正在使用带有Jquery UI的jquery fileupload插件。

https://github.com/blueimp/jQuery-File-Upload/wiki/Options

我希望覆盖掉小部件选项,例如maxUploadfilesize 如果我在主文件jquery.fileupload-ui.js中覆盖设置,则目前它会起作用。
var parentWidget = ($.blueimpFP || $.blueimp).fileupload;
    $.widget('blueimpUI.fileupload', parentWidget, {

        options: {
            // By default, files added to the widget are uploaded as soon
            // as the user clicks on the start buttons. To enable automatic
            // uploads, set the following option to true:
            autoUpload: true,
            //sequentialUploads, true,
            // The following option limits the number of files that are
            // allowed to be uploaded using this widget:
            maxNumberOfFiles: undefined,
            // The maximum allowed file size:
            maxFileSize: 20000000,
            // The minimum allowed file size:
            minFileSize: undefined,

有没有办法在我的HTML模板中覆盖它,以便我可以为不同的HTML页面进行不同的定制

我的意思是一些JavaScript代码,我可以将其放在模板中,覆盖默认设置

1个回答

2

他们的文档中提到,您可以覆盖它们。

只需将此代码放在插件初始化位置即可:

$('#fileupload').fileupload(
    'option',
    {
        maxFileSize: 4000000,
        sequentialUploads: true
    }
);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接