Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to render the path in struts html file attribute

 
venkateshwar rao ravula
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using <html:file property="theFile"> in jsp page from there i am uploading the image.in the actionform i have FormFile theFile.when i submit the jsp page the filepath is vanishing how to render that file path in the <html;file>.

Any one cam help me how instantiate FormFile.

Thanks

Venkateshwar Rao Ravula
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid you can't specifiy a pre-loaded value in this field. Neither Internet Explorer nor Firefox browsers will accept any server-side value in a file upload input control. It's a security issue.

Think about it. If it were possible to specify a server-specified value here, what would prevent a malicious website from pre-loading this field with the path where your Outlook file (containing all your personal information) is likely to be located, then having JavaScript submit the page before you even knew what was happening?
 
venkateshwar rao ravula
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill

I am storing the path in a hiden field.is there any way of converting that to FormFile object.

Thanks & Regards,

Venkateshwar Rao Ravula
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by venkateshwar rao ravula:
I am storing the path in a hiden field.is there any way of converting that to FormFile object.

No, I don't think so. The FormFile object has to contain the entire uploaded file, not just its path.

If you absolutely, positively have to get past this restriction, you might want to consider creating a signed applet to do your upload. With a signed applet, you can do pretty much whatever you want as far a defaults, remembering the last upload, etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic