文件上传
String fname = item.getName();
//根据文件原始名称,创建新文件名
String newFileName = UploadUtils.getUUIDName(fname);
//获取到存放图片根目录真实路径
String rootPath = getServletContext().getRealPath("/products/3");
//#_创建随机8层目录
String path01 = UploadUtils.getDir(newFileName);
File ranDir = new File(rootPath + path01);
if (!ranDir.exists()) {
    ranDir.mkdirs();
}
//#_创建文件
File file = new File(ranDir, newFileName);
if (!file.exists()) {
    file.createNewFile();
}
//#_流对接,通过item.getInputStream();将图片数据输出到文件中
OutputStream os = new FileOutputStream(file);
InputStream is = item.getInputStream();
IOUtils.copy(is, os);
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(os);