| | |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.response.upload.UploadResultDTO; |
| | | import com.mzl.flower.service.UploadService; |
| | | import com.mzl.flower.service.oss.TosOssService; |
| | | import com.mzl.flower.utils.FileUtil; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Autowired |
| | | private UploadService uploadService; |
| | | |
| | | @Autowired |
| | | private TosOssService tosOssService; |
| | | |
| | | private static List<String> fileType = Arrays.asList("zip", "jpg", "png", "gif", "jpeg", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "mp4", "wmv", "rmvb", "mpg", "mpeg", "3gp", "mov", "m4v", "avi", "flv"); |
| | | |
| | |
| | | String url = FileUtil.saveFile(path, bytes, fileName, uploadProperties.getFileGroup()); |
| | | uploadResult.setUrl(uploadProperties.getFileServerPath() + url);*/ |
| | | |
| | | String url = uploadService.upload(file.getInputStream(), fileName); |
| | | uploadResult.setUrl("https://" + url); |
| | | // String url = uploadService.upload(file.getInputStream(), fileName); |
| | | String url = tosOssService.uploadFile( file.getInputStream(),fileName); |
| | | // uploadResult.setUrl("https://" + url); |
| | | uploadResult.setUrl(url); |
| | | |
| | | uploadResult.setType(extName); |
| | | uploadResult.setSize(file.getSize()); |