[轉]jQuery file upload maxNumberOfFiles options--無用
I believe getNumberOfFiles was only added as an option to a recent version of jquery.fileupload-ui.js (8.2.1).
As an alternative, you can set the option singleFileUploads to false, and in the add callback you can throw errors if more than one file is added.
var maxFiles = 1;
$('#fileupload').fileupload({
singleFileUploads: false,
url: '/uploadUrl'
}).bind('fileuploadadd', function (e, data) {
var fileCount = data.files.length;
if (fileCount > maxFiles) {
alert("The max number of files is "+maxFiles);
return false;
}
});