javascript - Why does form action call not keep input file when using back button? -


function validate_form() {         //..... validation , other stuff go here ... } <form name="read" id="read" action="test2.php" method="post" enctype="multipart/form-data" onsubmit="return validate_form();">     <input type="file" name="pac" />     <input type="submit" name="submit" value="submit" /> </form> 

in above example, if hit browser button, input file remains.

function validate_form() {     //..... validation , other stuff go here ...     document.read.action = "test2.php";  } <form name="read" id="read" action="" method="post" enctype="multipart/form-data" onsubmit="return validate_form(this);">     <input type="file" name="pac" />     <input type="submit" name="submit" value="submit" /> </form> 

in above example, if hit browser button, input file cleared. why that? way around save input cookie or session variable? if so, not sure how save file.

i have reason use call js. removed of code above examples. happening under chrome , firefox. didn't test others.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -