GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes How to retain a selected file path in a input  type= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to retain a selected file path in a input  type="file" in html" Watch "How to retain a selected file path in a input  type="file" in html" New topic
Author

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

Sandeep R Kumar
Greenhorn

Joined: Apr 24, 2007
Posts: 11
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....


Thanks,<br />Sandeep
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to retain a selected file path in a input type="file" in html