修改上传位置

This commit is contained in:
2024-12-27 13:55:33 +08:00
parent 02b1aba9a2
commit 7a55a0b843
10 changed files with 51 additions and 42 deletions

View File

@@ -8,7 +8,6 @@ import com.ycwl.basic.utils.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -36,7 +35,7 @@ public class FileController {
public ApiResponse<?> upload(@RequestParam(value = "file") MultipartFile file) throws IOException {
String[] split = file.getOriginalFilename().split("\\.");
String ext = split[split.length - 1];
String url = StorageFactory.use("assets").uploadFile(file, "web", UUID.randomUUID()+"."+ext);
String url = StorageFactory.use("assets").uploadFile(file, "web", UUID.randomUUID() + "." + ext);
return ApiResponse.success(url);
}