文件上传
This commit is contained in:
parent
df23750203
commit
145238ea96
@ -56,7 +56,8 @@ public class FileController {
|
|||||||
})
|
})
|
||||||
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
|
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
|
||||||
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename();
|
String path = DateUtil.format(new Date(), "yyyy/MM/dd/") + file.getOriginalFilename();
|
||||||
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
|
String file1 = fileService.createFile(path, IoUtil.readBytes(file.getInputStream()));
|
||||||
|
return success(file1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
|
@ -127,7 +127,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res) {
|
||||||
this.uploadList.push({ name: res.fileName, url: res.fileName });
|
this.uploadList.push({ name: res.data, url: res.data });
|
||||||
if (this.uploadList.length === this.number) {
|
if (this.uploadList.length === this.number) {
|
||||||
this.fileList = this.fileList.concat(this.uploadList);
|
this.fileList = this.fileList.concat(this.uploadList);
|
||||||
this.uploadList = [];
|
this.uploadList = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user