Skip to content

Commit

Permalink
change:将TempFile.getSubmittedFileName换成TempFile.getMeta().getFileLoca…
Browse files Browse the repository at this point in the history
…lName(),感谢的大叔的issues,fix #17
  • Loading branch information
EggsBlue committed Feb 12, 2018
1 parent b72972c commit 8006bba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/dd/controller/UploadModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public class UploadModule {
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })
public Object image(@Param("file") TempFile file,ServletContext context){
System.out.println(file.getName());
System.out.println(file.getMeta().getFileLocalName());
String relpath = getDir()+"/upload/imgs/"+file.getMeta().getFileLocalName(); // 此为: D:\\apache-tomcat-8.0.36\\webapps\\upload\\tomat.png
System.out.println(file.getSubmittedFileName());
String relpath = getDir()+"/upload/imgs/"+file.getSubmittedFileName(); // 此为: D:\\apache-tomcat-8.0.36\\webapps\\upload\\tomat.png
Files.copy(file.getFile(),new File(relpath));

String url ="/upload/imgs/"+file.getMeta().getFileLocalName(); //eclipse默认的tomcat目录是在其缓存文件中,你要自己指定到tomcat所在目录
String url ="/upload/imgs/"+file.getSubmittedFileName(); //eclipse默认的tomcat目录是在其缓存文件中,你要自己指定到tomcat所在目录
//构建json数据
Map<String,Object> data = new HashMap<String,Object>();
data.put("code", "0");
Expand All @@ -80,10 +80,10 @@ public Object image(@Param("file") TempFile file,ServletContext context){
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })
public Object files(@Param("file") TempFile file,ServletContext context){
System.out.println(file.getName());
System.out.println(file.getMeta().getFileLocalName());
String relpath = getDir()+"/upload/files/"+file.getMeta().getFileLocalName(); // 此为: D:\\apache-tomcat-8.0.36\\webapps\\upload\\tomat.png
System.out.println(file.getSubmittedFileName());
String relpath = getDir()+"/upload/files/"+file.getSubmittedFileName(); // 此为: D:\\apache-tomcat-8.0.36\\webapps\\upload\\tomat.png
Files.copy(file.getFile(),new File(relpath));
String url ="/upload/files/"+file.getMeta().getFileLocalName(); //eclipse默认的tomcat目录是在其缓存文件中,你要自己指定到tomcat所在目录
String url ="/upload/files/"+file.getSubmittedFileName(); //eclipse默认的tomcat目录是在其缓存文件中,你要自己指定到tomcat所在目录
//构建json数据
Map<String,Object> data = new HashMap<String,Object>();
data.put("code", "0");
Expand Down

0 comments on commit 8006bba

Please sign in to comment.