引入css和js
<link rel="stylesheet" href="${base}plugin/bootstrap/css/fileinput.min.css">
<script src="${base}plugin/bootstrap/js/fileinput.min.js"></script>
html
<input type="file" class="projectfile" name="uploadPic" />
js设置样式
var projectfileoptions= {
showUpload:false,
showRemove:true,
language:'zh',
allowedPreviewTypes:[ 'image' ],
allowedFileExtensions:[ 'jpg', 'png', 'gif' ],
maxFileSize:10000
};
// 文件上传框
$('input[class=projectfile]').each(function() {
$(this).fileinput(projectfileoptions);
});