How to preset the value of p:fileUpload

非 Y 不嫁゛ 提交于 2020-01-10 05:46:09

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/5847385/how-to-preset-the-value-of-pfileupload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!