forked from integrated_whb/integrated_whb
修复视频上传
parent
f5579e9856
commit
51d29c72ef
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue