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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -