This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retain a selected file path in a input type="file" in html
 
Similar Threads
How to upload a Image using JAVA program
input file element
Checking file size before uploading
Hidden input type="file" technique
Retain File Selected in a File Upload Component