Tomcat is not obeying the servlet spec. The org.springframework.web.multipart.MultipartFile javadoc for the transferTo(File) method says:
"Note: when using Servlet 3.0 multipart support you need to configure the location relative to which files will be copied as explained in Part.write(java.lang.String)." The javax.servlet.http.Part javadoc for the write(String) method says: "fileName - the name of the file to which the stream will be written. The file is created relative to the location as specified in the MultipartConfig" In other words, you can't just write it anywhere on disk, it has to be a location relative to the location configured in MultipartConfig, which by default is the webapp's tmp directory. Jan On 17 May 2015 at 02:55, 五星上酱 <50712...@qq.com> wrote: > Hi ,every body > example code like this: > > > // mulitpartFiletype is org.springframework.web.multipart.MultipartFile > mulitpartFile.transferTo(new File("G:\\somedir/somefile")); > > > this code work well with Tomcat > > but ,when with Jetty , raises java.io.FileNotFoundException: > D:\projects\project1\target\tmp\G:\ somedir/somefile > > the problem is file path is prefixed with the tempolary path > Why Jetty will prefix an absolute path with the tempolary path? Can I > avoid it? > > hoping someone can help me.thanks > > > > _______________________________________________ > jetty-users mailing list > jetty-users@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users -- Jan Bartel <j...@webtide.com> www.webtide.com 'Expert assistance from the creators of Jetty and CometD' _______________________________________________ jetty-users mailing list jetty-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users