Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retain a selected file path in a input type="file" in html

 
Sandeep R Kumar
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a html form i am using input type 'file' to upload a file......i have given a link so that to create(using javascript) another input type 'file' in the same form below the previous one,if the user wants to upload another file.

Now my problem is that when the link is clicked the old selected file path is not retained and the file has to be selected again....

HOW CAN I RETAIN THE VALUE IN THE FIELD

Hope anyone has the solution for my problem....
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not keep the value on post back. It is a security risk.

You should create a new element with JavaScript or have multiple elements already there and just show them by setting their display/visibility.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic