JFinal文件上传

yizhi鬼 发布于 2016/04/19 21:44
阅读 540
收藏 0

@JFinal 你好,想跟你请教个问题:

我用JFinal文件上传功能,但是每次都会抛出异常,我的那个文件夹D:/temp是存在的,但是异常说不存在,我参考的代码是这个:  http://my.oschina.net/bloghu/blog/275289

2016-04-19 21:30:42
[ERROR]-[Thread: http-nio-8080-exec-8]-[com.jfinal.core.ActionHandler.handle()]: /upload
java.lang.RuntimeException: Directory E:\eclipseworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\jfinal_demo\upload\D:/temp not exists and can not create directory.
at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:95)
at com.jfinal.upload.MultipartRequest.<init>(MultipartRequest.java:63)
at com.jfinal.core.Controller.getFiles(Controller.java:756)
at com.jfinal.core.Controller.getFile(Controller.java:761)
at com.demo.index.IndexController.upload(IndexController.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jfinal.aop.Invocation.invoke(Invocation.java:73)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)


加载中
0
JFinal
JFinal

   提示信息说的是:E:\eclipseworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\jfinal_demo\upload 这个目录不存在,而不是 D:/temp

  建议用 jfinal 手册中的方式启动项目,这样就不会将上传文件存到 .metadata/.plugins 这样的地方了

y
yizhi鬼
回复 @JFinal : 噢,,我解决了,但是它好像是不能读 磁盘的,只能默认是在WebRoot/upload,直接读 D:/ 好像是读不出来。
JFinal
JFinal
回复 @yizhi鬼 : 开发的时候用这种方式就挺好
y
yizhi鬼
意思是使用Java Application 的方式启动吗??
返回顶部
顶部