Commit 1434dd54 authored by hanfeng's avatar hanfeng

修改图片批量上传

parent 2d8aaa9c
...@@ -77,7 +77,7 @@ public class UploadZipServiceImpl implements UploadZipService { ...@@ -77,7 +77,7 @@ public class UploadZipServiceImpl implements UploadZipService {
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement(); ZipEntry entry = entries.nextElement();
if (entry.isDirectory() && index++ == 0) { if (entry.isDirectory() && index++ == 0) {
File dir = new File(uploadPath+dirPathToday); File dir = new File(uploadPath+File.separator+dirPathToday);
dir.mkdir(); dir.mkdir();
} else if (!entry.isDirectory()) { } else if (!entry.isDirectory()) {
...@@ -89,12 +89,11 @@ public class UploadZipServiceImpl implements UploadZipService { ...@@ -89,12 +89,11 @@ public class UploadZipServiceImpl implements UploadZipService {
String format = name.substring(name.lastIndexOf(".")); String format = name.substring(name.lastIndexOf("."));
if (PHOTO_FORMAT.contains(format)) { if (PHOTO_FORMAT.contains(format)) {
String realFileRelPath = dirPathToday + File.separator + no +format; String realFileRelPath = dirPathToday + File.separator + no +format;
File targetFile = new File(uploadPath+realFileRelPath); File targetFile = new File(uploadPath+File.separator+realFileRelPath);
FileUtils.copyInputStreamToFile(zipFile.getInputStream(entry),targetFile); FileUtils.copyInputStreamToFile(zipFile.getInputStream(entry),targetFile);
realFileRelPath=xx_url+ SystemConfig.XXMP_URL+realFileRelPath; realFileRelPath=xx_url+ SystemConfig.XXMP_URL+File.separator+realFileRelPath;
result.append(realFileRelPath+","); result.append(realFileRelPath+",");
} }
} }
} }
result.substring(0,result.length()-1); result.substring(0,result.length()-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment