Commit 3c9f160d by tyfanchz

修改文件上传接口

1 parent 7873393f
package com.glsx.controller;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import cn.com.glsx.openplatform.enums.ResultCodeEnum;
......@@ -77,15 +75,10 @@ public class FileController {
@RequestMapping(value = "/uploadFile2", method = {RequestMethod.POST})
public Object uploadFile2() {
byte[] bytes;
try {
bytes = Files.readAllBytes(Paths.get(
"D:/Users/wbh/Desktop/glsx_car_service_sys_area.sql"));
String fileUrl = FdfsUtils.uploadFile(bytes, "sql");
System.out.println(fileUrl);
return R.ok().data(fileUrl);
} catch (IOException e) {
throw ResultCodeEnum.FILE_UPLOAD_ERROR.exception();
}
bytes = new byte[] {65, 10};
String fileUrl = FdfsUtils.uploadFile(bytes, "txt");
System.out.println(fileUrl);
return R.ok().data(fileUrl);
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!