84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
我知道有一个配置项multipart.max-file-size可以控制文件上传大小,但这个值为一全局配置无法细化到每个Controller,而使用MultipartFile类的getSize()方法判断大小的话文件必然已经全部上传到服务器了,我需要一个类似multipart.max-file-size配置项的效果,如果文件超出指定大小后直接中断请求,并能在每一个Controller中进行不同值得设置,谢谢。
小伙看你根骨奇佳,潜力无限,来学PHP伐。
Provide a solution Use multipart.max-file-size to configure the maximum file upload size=>Then get the size of the uploaded file in the code=>Judge whether the conditions are met
Pseudo code:
Boolean upload(String path,File file,Integer maxSize){ Intege fileSize = file.size(); if(fileSize<=maxSize){ //上传... return true; }else{ return false; } }
Provide a solution
Use multipart.max-file-size to configure the maximum file upload size=>Then get the size of the uploaded file in the code=>Judge whether the conditions are met
Pseudo code: