今天要比昨天吃苦的能力更强

fileinput 加 ftp 加 nginx 加 SpringBoot上传文件

亲测可用

准备linux服务器  https://www.cnblogs.com/shuaifing/p/8268949.html

 

搭建ftp https://www.cnblogs.com/shuaifing/p/8260532.html

 

Springboot整合fileinput

上传文件https://www.cnblogs.com/shuaifing/p/8274906.html

 

页面

引入 jquery boostrap  fileinput.min.js fileinput.min.css 

<form  method="post"   class="box-header with-border" action=""  id="dataFrom" enctype="multipart/form-data" >
<label>文件上传:</label>
<input id="file" name="file" multiple="multiple" type="file" class="file">
</form>

js
$(function(){
    var _allowedFile = ['jpg', 'png', 'gif', 'apk', 'zip', 'xlsx', 'xls'];
var _maxFileSize = 10000;
$("#file").fileinput({
language: 'zh', //设置语言
uploadUrl: ctx+"fileupload", //上传的地址
allowedFileExtensions: _allowedFile,//接收的文件后缀
uploadAsync: true, //默认异步上传
showUpload: true, //是否显示上传按钮
maxFileSize: _maxFileSize,
showRemove : true, //显示移除按钮
showPreview : false, //是否显示预览
showCaption: false,//是否显示标题
browseClass: "btn btn-primary", //按钮样式
dropZoneEnabled: false,//是否显示拖拽区域
maxFileCount: 1, //表示允许同时上传的最大文件个数
enctype: 'multipart/form-data',
validateInitialCount:true
});
});

health和images需要自己创建


 




})
posted @ 2018-10-30 17:15  Java野生程序猿  阅读(772)  评论(0编辑  收藏  举报