Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Walter.Wen
SpringBootFileUploadDownload
提交
a6ce3467
S
SpringBootFileUploadDownload
项目概览
Walter.Wen
/
SpringBootFileUploadDownload
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBootFileUploadDownload
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a6ce3467
编写于
3月 20, 2020
作者:
W
wenguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
头像上传图片成功校验
上级
d5ed8531
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
10 deletion
+9
-10
src/main/java/com/we/controller/PhotographController.java
src/main/java/com/we/controller/PhotographController.java
+4
-4
src/main/resources/templates/photograph/photo.html
src/main/resources/templates/photograph/photo.html
+5
-6
未找到文件。
src/main/java/com/we/controller/PhotographController.java
浏览文件 @
a6ce3467
...
...
@@ -35,9 +35,9 @@ public class PhotographController {
*/
@RequestMapping
(
"/photoUpload"
)
@ResponseBody
public
String
fileUpload
(
@RequestParam
(
"op"
)
String
op
,
@RequestParam
(
"base64url"
)
String
base64url
)
{
public
int
fileUpload
(
@RequestParam
(
"op"
)
String
op
,
@RequestParam
(
"base64url"
)
String
base64url
)
{
if
(!
"takePhoto"
.
equals
(
op
))
{
return
"false"
;
return
-
1
;
}
BASE64Decoder
decoder
=
new
BASE64Decoder
();
String
baseurl
=
base64url
.
replace
(
"data:image/png;base64,"
,
""
);
...
...
@@ -55,9 +55,9 @@ public class PhotographController {
out
.
flush
();
out
.
close
();
return
"true"
;
return
1
;
}
catch
(
Exception
e
)
{
return
"false"
;
return
0
;
}
}
...
...
src/main/resources/templates/photograph/photo.html
浏览文件 @
a6ce3467
...
...
@@ -136,14 +136,13 @@
var
base64url
=
cas
.
toDataURL
(
'
image/png
'
);
//转换为base64地址形式
base64url
=
base64url
.
replace
(
"
\r
"
,
""
)
$
.
post
(
"
/photograph/photoUpload
"
,
{
op
:
"
takePhoto
"
,
base64url
:
base64url
},
function
(
data
)
{
var
result
=
parseInt
(
$
.
trim
(
data
.
result
));
if
(
result
==-
1
){
$
.
messager
.
show
({
title
:
"
温馨提示
"
,
msg
:
"
输入的信息不完整,确认后重新提交。
"
,
timeout
:
3000
,
showType
:
'
slide
'
})
}
else
if
(
result
>
0
){
$
.
messager
.
show
({
title
:
"
成功提示
"
,
msg
:
"
头像更新成功
"
,
timeout
:
3000
,
showType
:
'
slide
'
})
if
(
data
==-
1
){
alert
(
"
输入的信息不完整,确认后重新提交
"
);
}
else
if
(
data
>
0
){
alert
(
"
头像更新成功
"
);
//$('#attendance_info').css('color','green').text("已提交");
}
else
{
$
.
messager
.
alert
(
"
失败提示
"
,
"
头像更新失败,请稍后重试...
"
,
'
error
'
)
alert
(
"
头像更新失败,请稍后重试...
"
);
}
},
"
JSON
"
);
//关闭裁剪框
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录