ICEFaces inputFile获取文件内容而不上传 [英] ICEFaces inputFile getting the file content without upload
问题描述
有什么方法可以仅获取浏览文件的内容而无需任何上载/文件传输操作?我目前使用ICEFaces inputFile组件,但不需要文件的默认上载操作.谢谢.
Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading operation of the file. Thanks.
推荐答案
这不可能.每当您希望在服务器端拥有文件内容时,客户端都需要沿着请求主体将文件内容发送(上传)到服务器端.
That's not possible. The client needs to send (upload) the file content along the request body to the server side whenever you want to have the file content at the server side.
如果您希望仅通过传递文件路径并使用常规的 java.io.File
之类的东西来解决此问题,那么您就走错了路.假设我是客户端,并且有一个 c:/passwords.txt
,作为网络另一端的服务器,您如何通过 java.io获得其内容.文件
?
If you'd expect that you can solve this by passing only the file path around and use the usual java.io.File
stuff and so on, then you're on the wrong track. Imagine that I am the client and I have a c:/passwords.txt
, how would you as being the server at the other end of the network ever get its content by java.io.File
?
这篇关于ICEFaces inputFile获取文件内容而不上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!