2012-06-27 76 views
0

我想允許用戶只在一些頁面上上傳1個文件,在其他頁面上上傳1個以上的文件。 有很地方改變這個數字自定義jQuery文件上傳的maxNumberOfFiles

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: false, 
     // The following option limits the number of files that are 
     // allowed to be uploaded using this widget: 
     maxNumberOfFiles: undefined, 

但是,如果我在這裏改變它,它將適用於網站上所有的jQuery上傳文件的控制。我如何定製選項maxNumberOfFiles來達到我的目的。

回答

0

你不能只是在每個頁面的選項中定義值嗎?

{ maxNumberOfFiles: 5} 

第2頁

{ maxNumberOfFiles: 1} 

或者在它自己的功能,傳遞您要爲ARG文件的數量包裹呢?

編輯: 行 - 你已經改變了這個問題,因爲我發佈了這個,但同樣的東西適用