Avatar of gopal_kgk
 asked on

retaining the filename with path in the HTML <input type="file"> tag on page refersh.


I am having a jsp page, which has textfields, select boxes &  file input tag for upload..

but, on changing one select box, I am realoding the another select box values from DB... for that I am submitting the request to servlet & cminig back again..I can reterirve all the tag values & rest them to old while I do refersh..

but I cant able to reset the value of the filename  to the file input tag. is there any way to retain that value(the file name I've browed & entered)  in the file input tag even on page refersh?
Java EEProgramming

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Plain ol ASP

// create a new Session variable to store the users name
Session ( 'File' ) = 'myFileName';

// display the name in any page on your site
Out ( 'Your name is ' + Session ( 'File' ) );

TedInAK is absolutely correct.  You can't set or get the file input values even though it appears to be a normal input tag.  Both previous answers are possible solutions, though I would recommend using AJAX to get new content and modify your page without having to reload.  

With ajax, you can submit information to your server, and retrieve the results without reloading or redirecting the page.  It's quick, nifty, clean, and it's becoming quite popular so there are many resources to help you out.

One i know if is http://ajaxtags.sourceforge.net/ which is a jsp library for using ajax.  It comes with several examples with source code.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes