Flex和Servlet结合上传文件报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flex和Servlet结合上传文件报错相关的知识,希望对你有一定的参考价值。
1、详细报错例如以下
一个表单域 不是一个表单域 java.io.FileNotFoundException: D:\MyEclipse\workspace\FlexFileUpload\Web\uploadFolder\鏌卞舰鍥?xls (文件名称、文件夹名或卷标语法不对。) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:179) at java.io.FileOutputStream.<init>(FileOutputStream.java:70) at com.you.upload.servlet.FlexFileUploadServlet.doPost(FlexFileUploadServlet.java:129) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) 一个表单域 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
2、错误原因
String fileName = item.getName(); File remoteFile = new File(new String(item.getName().getBytes(), "GBK")); byte[] data = item.get(); /** * 获取文件上传路径 */ String uploadFolder = getServletConfig().getInitParameter("uploadFolder"); String fileFolderName = getServletContext().getRealPath(uploadFolder + "\\" + remoteFile);
3、解决的方法
以上是关于Flex和Servlet结合上传文件报错的主要内容,如果未能解决你的问题,请参考以下文章
SpringBoot 上传文件突然报错 Failed to parse multipart servlet request; nested exception is java.io.IOExcepti
springboot报错说 Failed to parse multipart servlet request; nested exception is java.io.IOException(代码片