如何预设p:fileUpload的值 [英] How to preset the value of p:fileUpload
本文介绍了如何预设p:fileUpload的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用< p:fileUpload>
组件。是否有可能预先选择并显示在浏览按钮之前的字段中选择的文件?
我使用Mojarra 2.0.3,PrimeFaces 2.2 RC2,GlassFish 3。
解决方案
不,如果可能的话,这将是一个巨大的安全漏洞。理论上你可以让选中的文件指向 C:/path/to/passwords.txt
,然后使用JavaScript提交表单,然后默默地获得文件与敏感数据从客户端未经其许可。
另见:
- 如何设置文件的值输入HTML?
- 使用p:fileUpload发送完整的客户端文件路径到服务器端
I am using <p:fileUpload>
component. Is it possible to preselect and show the selected file in field before the browse button?
I am using Mojarra 2.0.3, PrimeFaces 2.2 RC2, GlassFish 3.
解决方案
No, if this was possible, this would have been a huge security hole. You would then in theory be able to let the selected file point to C:/path/to/passwords.txt
and then use JavaScript to submit the form and so silently get a file with sensitive data from the client without its permission.
See also:
- How to set a value to a file input in HTML?
- Send full client side file path to server side using p:fileUpload
这篇关于如何预设p:fileUpload的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文