Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
36 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
spring-boot-fastDFS/src/main/java/com/neo/config/Configurations.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
spring-boot-file-upload/src/main/resources/templates/from_file.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<form id='myupload' action='http://localhost:8080/uploadSign' method='post' enctype='multipart/form-data'> | ||
<div class="demo"> | ||
<div class="btn"> | ||
<span>添加附件</span> | ||
<input id="fileupload" type="file" name="file1"></div> | ||
<div class="progress"> | ||
<span class="bar"></span> | ||
<span class="percent">0%</span></div> | ||
<!-- 显示已上传的文件名 --> | ||
<div class="files"></div> | ||
<!-- 显示已上传的图片--> | ||
<div class="showimg"></div> | ||
</div> | ||
<input type="submit" onclick="gosubmit2()" /></form> | ||
<script src="https://cdn.bootcss.com/jquery/1.6.4/jquery.js"></script> | ||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery.form/4.1.0/jquery.form.min.js"></script> | ||
<script type="text/javascript">var bar = $('.bar'); //进度条 | ||
var percent = $('.percent'); //获取上传百分比 | ||
var showimg = $('.showimg'); //显示图片的div | ||
var progress = $('.progress'); //显示进度的div | ||
var files = $('.files'); //文件上传控件的input元素 | ||
var btn = $('.btn span'); //按钮文本 | ||
function gosubmit2() { | ||
$("#myupload").ajaxSubmit({ | ||
dataType: 'json', | ||
//返回数据类型 | ||
beforeSend: function() { | ||
showimg.empty(); | ||
progress.show(); | ||
var percentVal = '0%'; | ||
bar.width(percentVal); | ||
percent.html(percentVal); | ||
btn.html('上传中..'); | ||
}, | ||
//更新进度条事件处理代码 | ||
uploadProgress: function(event, position, total, percentComplete) { | ||
var percentVal = percentComplete + '%'; | ||
bar.width(percentVal); | ||
percent.html(percentVal); | ||
}, | ||
success: function(data) { //图片上传成功时 | ||
//获取服务器端返回的文件数据 | ||
alert(data.name + "," + data.pic + "," + data.size); | ||
}, | ||
error: function(xhr) { | ||
btn.html(上传失败); | ||
bar.width('0'); | ||
files.html(xhr.responseText); | ||
} | ||
}); | ||
}</script> |