• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pass filename+contens as hidden fields to servlet from jsp

 
Ravi Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have declared the browse file declaration as below

<form name frm2>
<input class="BrowseFile" name="filename" onchange="addAttachment();" onkeypress="return uploadAttachmentOnEnter()" type="file">
</form>

Now i want to pass this "filename" as hidden to servlet from jsp with contents. I have declared a hidden variable in jsp and try to assign the "filename" to that variable it is passing only filename but not contents available inside the file.

Please suggest me how to pass the filename+contents to servlet from jsp.

Thanks
Ravi Kumar. A
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use

However, there are restrictions. You will only get a hold of the filename, not the filepath. This is somewhat in terms of confidentiality. I wouldn't want everybody to know about my directory structure.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic