基本版本:v4.3.3
1、基本引入
? ??fileinput.min.js宦芦、fileinput.min.css嘹履、zh.min.js(可選腻扇,中文漢化)
2、頁面組件
? ?<inputid="myFile" name="uploadImgFile" type="file" value="上傳" multiple data-show-caption="true" class="myfile" />
3砾嫉、Javascript 使用
$(document).ready(function() {
$('#myFile').fileinput({
????//初始化上傳文件框
? ?language: "zh",//配置語言
? ? showUpload : true, //顯示整體上傳的按鈕
? ? showRemove : true,//顯示整體刪除的按鈕
? ? uploadAsync: true,//默認異步上傳
? ? uploadLabel: "上傳",//設(shè)置整體上傳按鈕的漢字
? ? removeLabel: "移除",//設(shè)置整體刪除按鈕的漢字
? ? uploadClass: "btn btn-primary",//設(shè)置上傳按鈕樣式
? ? showCaption: true,//是否顯示標(biāo)題
? ? dropZoneEnabled: false,//是否顯示拖拽區(qū)域?
? ? uploadUrl: 'uploadImgFile.do',//這個是配置上傳調(diào)取的后臺地址衙解,本項目是SSM搭建的
? ? maxFileSize : 9999,//文件大小限制
? ? maxFileCount: 9999,//允許最大上傳數(shù),可以多個焰枢,
? ? enctype: 'multipart/form-data',
? ? allowedFileExtensions : ["jpg", "png","gif","docx","zip","xlsx","txt","db"],/*上傳文件格式限制*/
? ? msgFilesTooMany: "選擇上傳的文件數(shù)量({n}) 超過允許的最大數(shù)值{m}蚓峦!",
? ? showBrowse: true,
? ? showPreview:false,
? ? browseOnZoneClick: true,
? ? slugCallback : function(filename) {
? ? ? ? return filename.replace('(', '_').replace(']', '_');
? ? },
? ? uploadExtraData:function(){
? ? ???? var data={
? ? ???????????? id:$("#id").val()
? ? ? ? ? }
? ? ? ? ?return data;
? ? }
})
});