Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with [html:file] tag

 
Tuhin Ghosh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI..,
Am using struts ... to build a content management system
I am Using <html:file></html:file> tag to get the file from the local system
Everything 's working fine in the Action
How ever on reload the page is displayed without any File name which was selected earlier....
On viewing soutce of the page
I found the "file name" in the <html:file value="c:/desktop/abc.xsl"></html:file>
My question is
1) If i am setting the value in the struts property file
Why its not displaying...?
2) In case there is any other way to resolve the issue...Explain


Thanks in advance

Tuhin

[ September 23, 2007: Message edited by: Tuhin Ghosh ]
[ September 23, 2007: Message edited by: Tuhin Ghosh ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though the <input type="file" > HTML element accepts a value attribute, neither Internet Explorer nor FireFox will display any value set on the server-side in this control. In short: There's no way have a value placed in this control when the page is refreshed.

It's a security issue. If it were allowed, what would prevent a malicious website from populating this field with the name of your Outlook file with all your contacts and then having JavaScript submit the page before you even knew what was happening?

About the only way I know to work around this would be to use an Applet for your upload. If you look around, I suspect you will find some already written for this purpose.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic