更改上传时文件名
parent
8981f0f168
commit
a4835b1ab2
|
@ -214,11 +214,9 @@ public class VideoServiceImpl implements VideoService {
|
||||||
String result = originalFilename.substring(0, dotIndex);
|
String result = originalFilename.substring(0, dotIndex);
|
||||||
// 获取文件后缀,因此此后端代码可接收一切文件,上传格式前端限定
|
// 获取文件后缀,因此此后端代码可接收一切文件,上传格式前端限定
|
||||||
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
|
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
|
||||||
// 重构文件名称
|
|
||||||
String newVideoName = UUID.randomUUID().toString().replaceAll("-", "") + "." + fileExt;// 新的文件名
|
|
||||||
|
|
||||||
vodConfig.put("filename", originalFilename + fileExt); // 此参数不重要,只要能保留文件后缀名如 a.mp4 即可
|
vodConfig.put("filename", result + fileExt); // 此参数不重要,只要能保留文件后缀名如 a.mp4 即可
|
||||||
vodConfig.put("vn", newVideoName); // .. . 分组配置、回调参数
|
vodConfig.put("vn", result); // .. . 分组配置、回调参数
|
||||||
JSONObject body = new JSONObject();// 构建body对象
|
JSONObject body = new JSONObject();// 构建body对象
|
||||||
body.put("channel", "VOD_UPLOAD");
|
body.put("channel", "VOD_UPLOAD");
|
||||||
body.put("vodConfig", vodConfig);
|
body.put("vodConfig", vodConfig);
|
||||||
|
|
Loading…
Reference in New Issue