Reputation: 1017
I have a form that submits the results to an iframe. The submitted fields and file upload are handled by upload.php. Everything works as expected creating an ajax style result although I want the form to reset after a successful file submission. Otherwise the submit button will keep uploading the same file.
form
<form action="functions/upload.php" method="POST" enctype="multipart/form-data" name="form1" id="form1" target="fileupload">
iframe
<iframe name="fileupload" frameborder="0" src="functions/upload.php" style="float:none; color:#FFF; display:none" width="100%" id="result" allowtransparency="true"></iframe>
Upvotes: 0
Views: 1302
Reputation: 9858
You can run the following JavaScript code inside the iframe
right after the file has been successfully uploaded.
parent.document.getElementById("form1").reset();
Upvotes: 4