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>...