| | |
| | | |
| | | import com.aliyun.oss.OSSClient; |
| | | import com.aliyun.oss.model.ObjectMetadata; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @ApiOperation(value = "文件上传",notes="文件上传") |
| | | @PostMapping("/uploadFile") |
| | | @ResponseBody |
| | | public R<String> upload(HttpServletRequest request, @RequestPart("file") MultipartFile picture) { |
| | | public AjaxResult upload(HttpServletRequest request, @RequestPart("file") MultipartFile picture) { |
| | | String filePath=""; |
| | | try { |
| | | filePath = ossUpload(request,picture); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(filePath); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", filePath); |
| | | return ajax; |
| | | } |
| | | |
| | | public static String oss_domain = "https://yizhengcheng.oss-cn-chengdu.aliyuncs.com/"; |