|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
|
+import org.apache.tomcat.util.http.fileupload.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -94,7 +95,7 @@ public class FaceppController extends ControllerSupport {
|
|
|
|
|
|
List<Map<String, String>> ret = Lists.newArrayList();
|
|
|
|
|
|
- String tempDirPath = storeLocation.getCanonicalPath() + File.separator
|
|
|
+ String tempDirPath = storeLocation.getParent() + File.separator
|
|
|
+ System.currentTimeMillis();
|
|
|
File tempDir = new File(tempDirPath);
|
|
|
try {
|
|
@@ -113,6 +114,7 @@ public class FaceppController extends ControllerSupport {
|
|
|
Map<String, String> map = Maps.newHashMap();
|
|
|
|
|
|
if (f.length() > MAX_SIZE * 1024) {
|
|
|
+ map.put("file", f.getName());
|
|
|
map.put("statusCode", "EX-620005");
|
|
|
map.put("statusDesc", "文件大小超过500KB");
|
|
|
ret.add(map);
|
|
@@ -133,7 +135,7 @@ public class FaceppController extends ControllerSupport {
|
|
|
ret.add(map);
|
|
|
}
|
|
|
|
|
|
- tempDir.delete();
|
|
|
+ FileUtils.deleteDirectory(tempDir);
|
|
|
|
|
|
return ret;
|
|
|
}
|