1

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
neni
  • 813
  • 5
  • 16
  • 34

1 Answers1

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:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Hi BalusC, Thank you for the reply. I agree with you. But, Is it possible to show the file name atleast. – neni May 03 '11 at 05:03
  • I am requesting you to please look at my question regarding "How to display a confirmation dialog from backing bean" http://stackoverflow.com/questions/5832222/how-to-display-a-confirmation-dialog-from-backing-bean – neni May 03 '11 at 05:15
  • No, this is not possible with HTML. Period. Your best bet is a signed(!) applet. – BalusC May 03 '11 at 11:09
  • Ok.. I am able to convince my customer on this issue. Thank you for the help. – neni May 12 '11 at 12:42