修复视频上传

pull/4/head
zhangqihang 2024-02-23 09:52:53 +08:00
parent f5579e9856
commit 51d29c72ef
1 changed files with 10 additions and 1 deletions

View File

@ -53,12 +53,21 @@ public class AppImgFilesController extends BaseController {
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) {
String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail";
map.put("result", errInfo);
map.put("msg", "文件格式不正确!");
return map;
}
}
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
// 保存文件
File tempFile = new File(file.getOriginalFilename());
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("3")) {//四色图改为json文件,不用判断类型
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("3") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型
map.put("result", "failed");
map.put("exception", "上传图片格式不正确,请重新上传");
return map;