hi,
i am having problems while uploading a file.
i created an input element of file type and appended it to a form.
after selecting the file when i click on submit the form becomes blank and i again need to select the file.
and it works in the second attempt
i cant figure out why its happening
please help
here is the code
//main.php
Code:
//upload.php
Code:
i am having problems while uploading a file.
i created an input element of file type and appended it to a form.
after selecting the file when i click on submit the form becomes blank and i again need to select the file.
and it works in the second attempt
i cant figure out why its happening
please help
here is the code
//main.php
Code:
Code:
<html> <head> <script type="text/javascript"> function load() { var element=document.createElement("input"); element.type="file"; element.id="file"; element.name="file"; var parent=document.getElementById("mailform"); parent.appendChild(element); element.click(); } </script> </head> <body> <form name="mailform" id="mailform" method='post' action='upload.php' enctype="multipart/form-data"> <input type="submit"> </form> <a href="javascript:load();">load</a> </body> </html>
Code:
Code:
<?php $m='file'; move_uploaded_file($_FILES[$m]["tmp_name"],"upload/" . $_FILES[$m]["name"]); ?>
Comment