|
@@ -18,7 +18,6 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import org.apache.commons.codec.DecoderException;
|
|
|
import org.apache.commons.codec.binary.Hex;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
-import org.apache.commons.fileupload.FileItem;
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
@@ -936,8 +935,15 @@ public class OrgController extends ControllerSupport {
|
|
|
|
|
|
validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
|
|
- FileItem fileItem = file.getFileItem();
|
|
|
- String name = fileItem.getName();
|
|
|
+ DiskFileItem fileItem = (DiskFileItem) file.getFileItem();
|
|
|
+ File storeLocation = fileItem.getStoreLocation();
|
|
|
+ String name = file.getOriginalFilename();
|
|
|
+
|
|
|
+ System.out.println(storeLocation.length());
|
|
|
+ if (999999 < storeLocation.length()) {
|
|
|
+ throw new StatusException("140082", "文件过大");
|
|
|
+ }
|
|
|
+
|
|
|
String fileSuffix = null;
|
|
|
if (name.endsWith(".jpg")) {
|
|
|
fileSuffix = ".jpg";
|
|
@@ -950,8 +956,9 @@ public class OrgController extends ControllerSupport {
|
|
|
}
|
|
|
|
|
|
byte[] byteArray = null;
|
|
|
- InputStream inputStream = file.getInputStream();
|
|
|
+ InputStream inputStream = null;
|
|
|
try {
|
|
|
+ inputStream = new FileInputStream(storeLocation);
|
|
|
byteArray = IOUtils.toByteArray(inputStream);
|
|
|
} finally {
|
|
|
IOUtils.closeQuietly(inputStream);
|