Commit 175b0640 by 阳浪

文件上传

parent f7e15fdf
......@@ -28,15 +28,14 @@ public class FileUploadController {
String pcHostUrl;
@PostMapping("/upload")
public Response<String> uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("Filename")String Filename) {
public Response<String> uploadFile(@RequestParam("file") MultipartFile file) {
try {
String[] fileNames = Filename.split("/");;
String bucketName =fileNames[0];
String name = fileNames[1];
String bucketName =propertiesUtil.getPublicParam().get("ossdir");;
String name = file.getOriginalFilename();
minioTools.uplodFile(bucketName,name,file.getInputStream());
return Response.ok(pcHostUrl+"/api/v1/buckets/"+bucketName+"/objects/download/?preview=true&prefix="+name);
} catch (IOException ex) {
return Response.fail("Could not upload the file: " + Filename);
return Response.fail("Could not upload the file ");
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment