1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//获得额外参数的方法
fodderType = function() {
return $("#fodderTypeSelect").val();
};
//初始化fileinput控件(第一次初始化)
function initFileInput(ctrlName, FileExtensions, fileSize) {
var control = $('#' + ctrlName);
control.fileinput({
language: 'zh', //设置语言
uploadUrl: "/WxMedia/ImageUpload", //上传的地址
allowedFileExtensions: FileExtensions, //接收的文件后缀
showUpload: true, //是否显示上传按钮
showCaption: true, //是否显示标题,
maxFileSize: fileSize * 1000, //单位为kb,如果为0表示不限制文件大小
browseClass: "btn btn-primary", //按钮样式
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
initialCaption: "请选择上传素材",
uploadExtraData: function(previewId, index) { //额外参数的关键点
var obj = {};
obj.fodder = fodderType();
console.log(obj);
return obj;
}
});
}
|