付智勇

no message

... ... @@ -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
... ...
... ... @@ -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"/>
... ...