Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
付智勇
/
koa2_Sequelize_project
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
付智勇
8 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a951ab9105bbad89bf692eabc166a21a6c83dd7
1a951ab9
1 parent
819dd0fe
no message
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
8 行增加
和
2 行删除
routes/upload.js
views/index.html
routes/upload.js
查看文件 @
1a951ab
...
...
@@ -37,7 +37,13 @@ router.post('/upLoadDoc',uploaddemo, async (ctx, next) => {
category
:
category
,
path
:
'http://localhost:10000/'
+
ctx
.
req
.
file
.
originalname
}
let
attachment
=
await
attachmentModel
.
create
(
attachmentData
)
let
oldAttachment
=
await
attachmentModel
.
findOne
({
where
:{
businessId
:
businessId
}})
if
(
oldAttachment
){
let
oldAttachment
=
await
attachmentModel
.
update
({
path
:
'http://localhost:10000/'
+
ctx
.
req
.
file
.
originalname
},{
where
:{
businessId
:
businessId
}})
}
else
{
let
attachment
=
await
attachmentModel
.
create
(
attachmentData
)
}
ctx
.
response
.
status
=
200
;
ctx
.
body
=
{
fileUrl
:
'http://localhost:10000/'
+
ctx
.
req
.
file
.
originalname
...
...
views/index.html
查看文件 @
1a951ab
...
...
@@ -7,7 +7,7 @@
<script
src=
"http://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"
></script>
</head>
<body>
<form
action=
"/upload/upLoadDoc?businessId=
1
&category=1"
method=
"post"
enctype=
"multipart/form-data"
>
<form
action=
"/upload/upLoadDoc?businessId=
0aJeQOYgLAo5yB1mE14Rvzb69V7mpZKD
&category=1"
method=
"post"
enctype=
"multipart/form-data"
>
<input
type=
"file"
name=
"file"
/>
<input
type=
"text"
value=
"1212"
name=
"class"
>
<input
type=
"submit"
value=
"ok"
/>
...
...
请
注册
或
登录
后发表评论