文件上传

This commit is contained in:
JeromeSoar 2022-04-24 18:02:25 +08:00
parent e3589eae11
commit df23750203
3 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ public class FileController {
@ApiImplicitParam(name = "file", value = "文件附件", required = true, dataTypeClass = MultipartFile.class),
})
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getName();
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename();
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
}

View File

@ -77,7 +77,7 @@ export default {
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadImgUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/simple-upload", //
headers: {
Authorization: "Bearer " + getToken(),
},

View File

@ -95,7 +95,7 @@
</el-popover>
</el-form-item>
<el-form-item label="分类图片" prop="bannerUrl">
<el-input v-model="form.bannerUrl" placeholder="请输入分类图片"/>
<ImageUpload v-model="form.bannerUrl" />
</el-form-item>
<el-form-item label="分类排序" prop="sort">
<el-input-number v-model="form.sort" controls-position="right" :min="0" />