How to get only the filename with Jersey File Upload
I'm doing a file upload with Jersey, but I need only the filename. Internet Explorer sends the entire path, and based on what's in FormDataContentDisposition, Jersey parses out the slashes, so I can't even parse that. Thanks.
Sounds like a difficult issue. The ideal case of course is to grab the string containing the slashes and just use string.split!
Failing that, the only strategy i can begin to think of is to try iterating through the string seeing if folders exist for various lengths of the first part of the string etc. This can cause problems too though if you intend to find a folder "MyFolder (2)" and theres also a "MyFolder". I don't know alot about jersey but i would recommend trying to find a different way to grab the string you need.
That hidden input then gets submitted along with the rest of the form.
@kombat has found this solution and posted it as a comment. For better this is now reposted as a community wiki answer.
I was getting that error when I tried the Eclipse browser. When I tried my code on Chrome, the FormDataContentDisposition.getFileName() was fine.
链接地址: http://www.djcxy.com/p/16304.html上一篇: 两个字符串序列中最长的公共子字符串
下一篇: 如何仅通过泽西文件上传获取文件名