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>();
|
Map<String,Object> map = new HashMap<String,Object>();
|
||||||
String errInfo = "success";
|
String errInfo = "success";
|
||||||
if (files != null && files.length > 0) {
|
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++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
MultipartFile file = files[i];
|
MultipartFile file = files[i];
|
||||||
// 保存文件
|
// 保存文件
|
||||||
File tempFile = new File(file.getOriginalFilename());
|
File tempFile = new File(file.getOriginalFilename());
|
||||||
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
|
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("result", "failed");
|
||||||
map.put("exception", "上传图片格式不正确,请重新上传");
|
map.put("exception", "上传图片格式不正确,请重新上传");
|
||||||
return map;
|
return map;
|
||||||
|
|
Loading…
Reference in New Issue