0

I want to allow user upload only 1 file on some pages and more than 1 file on other pages. There're place to change this number

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,

But if I change it here, it will be applied for all the jQuery Upload File controls on website. How can I customize the option maxNumberOfFiles to achieve my purpose.

Jin Ho
  • 3,565
  • 5
  • 23
  • 25

1 Answers1

0

Can you not just define the value in the options for each page?

Page 1

{ maxNumberOfFiles: 5}

Page 2

{ maxNumberOfFiles: 1}

Or wrap it in it's own function passing in the number of files you want as an arg?

EDIT: OK - you've changed the question slightly since I posted this but the same thing applies

Dave Hogan
  • 3,201
  • 6
  • 29
  • 54