当前位置:网站首页>项目上传部分
项目上传部分
2022-04-23 07:27:00 【桑英豪】
OSS 通用上传接口
/** * OSS文件上传 * @param file * @return */ @PostMapping("/uploadFileByOSS") public ResultJson uploadFileByOSS(MultipartFile file){ try { QueryWrapper<OssConfig> ossConfigQueryWrapper = new QueryWrapper<>(); ossConfigQueryWrapper.last("limit 1"); OssConfig ossConfig = ossConfigService.getOne(ossConfigQueryWrapper); return ResultJson.ok(OssUtils.alibabaUploadFile(file, ossConfig)); } catch (Exception e) { log.error(e.getMessage()); return ResultJson.failure(ResultCode.BAD_REQUEST, e.getMessage()); } }
html添加部分
<el-form-item prop="thumbnail" label="缩略图" :label-width="dialogFormLabelWidth" style="width:325px"> <span> <img width="100%" :src="uploadUrlPath" alt=""> </span> <el-upload drag :action="uploadOSS" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload" :on-error="handleUploadError" name="file" :show-file-list="false" :headers="headers" > <i class="el-icon-upload"></i> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> </el-upload> </el-form-item>
![]()
![]()
![]()
版权声明
本文为[桑英豪]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_62902168/article/details/124351929
边栏推荐
- Weekly leetcode - 06 array topics 7 ~ 739 ~ 50 ~ offer 62 ~ 26 ~ 189 ~ 9
- Description of the abnormity that the key frame is getting closer and closer in the operation of orb slam
- 二维01背包
- PHP generates short links: convert numbers to letters and letters to numbers
- mysql查询字符串类型的字段使用数字类型查询时问题
- Distributed service governance Nacos
- nn.Module类的讲解
- Smart business card applet business card details page function implementation key code
- 一个必看的微信小程序开发指南1-基础知识了解
- WordPress love navigation theme 1.1.3 simple atmosphere website navigation source code website navigation source code
猜你喜欢
跨域配置报错: When allowCredentials is true, allowedOrigins cannot contain the special value “*“
Community group purchase applet source code + interface DIY + nearby leader + supplier + group collage + recipe + second kill + pre-sale + distribution + live broadcast
岛屿的个数
LeetCode简单题之三除数
396. Rotate Function
搜一下导航完整程序源码
【解释】get ORA-12838: cannot read/modify an object after modifying it in parallel
Distributed service governance Nacos
One click cleanup of pycharm and jupyter cache files under the project
The third divisor of leetcode simple question
随机推荐
Qt编译QtXlsx库
Generate and parse tokens using JWT
vslam PPT
Brief description of CPU
MySQL数据库中delete、truncate、drop原理详解
一个必看的微信小程序开发指南1-基础知识了解
Usage of databinding
数据的删除和修改操作(mysql)
clang 如何产生汇编文件
LeetCode简单题之重新排列日志文件
Talk about the basic but not simple stock data
Data security has become a hidden danger. Let's see how vivo can make "user data" armor again
Distributed service governance Nacos
浏览器中的 Kubernetes 和 IDE | 交互式学习平台Killercoda
Weekly leetcode - 06 array topics 7 ~ 739 ~ 50 ~ offer 62 ~ 26 ~ 189 ~ 9
Discussion on ES6 tail tune optimization
colorui 解决底部导航遮挡内容问题
剑指offer day24 数学(中等)
输入/输出系统
2022.4.11-4.17 AI industry weekly (issue 93): the dilemma of AI industry