该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
反编译下:
mmspack.FileUpload:
public int upload(HttpServletRequest paramHttpServletRequest, String paramString)
throws IOException
{
this.paramMap.clear();
this.paramMap.putAll(paramHttpServletRequest.getParameterMap());
this.fileNames.clear();
this.charEncoding = paramHttpServletRequest.getCharacterEncoding();
if ((this.charEncoding != null) && (this.charEncoding.equalsIgnoreCase(System.getProperty("file.encoding"))))
this.charEncoding = null;
String str1 = paramHttpServletRequest.getContentType();
int i = str1 != null ? str1.indexOf("multipart/form-data; boundary=") : -1;
if (i == -1)
{
this.err = "request对象内容无效!";
return -1;
}
String str2 = "--" + str1.substring(i + "multipart/form-data; boundary=".length());
if (((this.maxSize > 0L) && (paramHttpServletRequest.getContentLength() > this.maxSize)) || (paramHttpServletRequest.getContentLength() <= 0))
{
this.err = "数据大小无效或超出允许范围!";
return -1;
}
if ((paramString == null) || (paramString.equals("")))
{
this.err = "无效目标路径!";
return -1;
}
if (File.separatorChar == '/')
paramString = paramString.replace('\\', File.separatorChar);
else
paramString = paramString.replace('/', File.separatorChar);
if (!paramString.endsWith(File.separator))
paramString = paramString + File.separator;
this.realPath = paramString.substring(0, paramString.length() - 1);
ServletInputStream localServletInputStream = paramHttpServletRequest.getInputStream();
while (true)
{
String[] arrayOfString1 = getContentNames(localServletInputStream);
if (arrayOfString1 == null)
break;
for (String str3 = readLine01(localServletInputStream); (str3 != null) && (!str3.equals("")); str3 = readLine01(localServletInputStream));
if (str3 == null)
break;
if (arrayOfString1[1] == null)
{
if (this.charEncoding != null)
arrayOfString1[0] = new String(arrayOfString1[0].getBytes(), this.charEncoding);
String str4 = readParam(localServletInputStream, str2);
if (this.charEncoding != null)
str4 = new String(str4.getBytes(), this.charEncoding);
String[] arrayOfString2 = (String[])this.paramMap.get(arrayOfString1[0]);
if (arrayOfString2 == null)
{
this.paramMap.put(arrayOfString1[0], new String[] { str4 });
}
else
{
String[] arrayOfString3 = new String[arrayOfString2.length + 1];
System.arraycopy(arrayOfString2, 0, arrayOfString3, 0, arrayOfString2.length);
arrayOfString3[arrayOfString2.length] = str4;
this.paramMap.put(arrayOfString1[0], arrayOfString3);
}
}
else if (arrayOfString1[1].length() > 0)
{
for (int j = 0; j < this.forbiddenFiles.length; j++)
if (arrayOfString1[1].toLowerCase().endsWith(this.forbiddenFiles[j]))
{
this.err = "无效文件类型";
return -1;
}
File localFile = new File(paramString);
if (!localFile.exists())
localFile.mkdirs();
if (saveDataToFile(localServletInputStream, paramString + arrayOfString1[1], str2))
{
if (this.charEncoding != null)
arrayOfString1[1] = new String(arrayOfString1[1].getBytes(), this.charEncoding);
this.fileNames.add(arrayOfString1[1]);
}
}
}
return this.fileNames.size();
}