Link to home
Start Free TrialLog in
Avatar of gopal_kgk
gopal_kgk

asked on

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

Hi!

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?
ASKER CERTIFIED SOLUTION
Avatar of TedInAK
TedInAK
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ryankahan
ryankahan

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.