|
|
|
@ -17,9 +17,7 @@ import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.upload.UploadFile;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class YpController extends Controller {
|
|
|
|
|
YpModel model = new YpModel();
|
|
|
|
@ -268,6 +266,15 @@ public class YpController extends Controller {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "上传文件类型错误!系统只允许上传jpg格式!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//判断文件大小大于20mb则返回错误信息,并终止上传,删除上传文件
|
|
|
|
|
long size = picFile.getFile().length();
|
|
|
|
|
if (size > 1024 * 1024 * 20) {
|
|
|
|
|
Map map = new HashMap();
|
|
|
|
|
map.put("success", false);
|
|
|
|
|
map.put("message", "图片文件大小大于20MB,请检查后重传!");
|
|
|
|
|
renderJson(map);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
|
//判断目录是不是存在
|
|
|
|
|
File file = new File(PathKit.getWebRootPath() + "/upload");
|
|
|
|
|