I am trying to solve a problem with <input type="file" /> using php. What currently happens is, the user enters a file path from their computer into the box, and then they hit submit. However after the page is posted back to itself, the box is wiped clean. What I would like to do is get the whole path name that the user puts into the file box to stay there after submit. I'm not the best programmer in the world so go easy on my and I would be grateful for any feedback.
An easy way would be storing the value of the box to a variable (and use hidden forms if you want) and calling it back once the form is submitted.
As far as I know, you can not preset the value for a file input field, nor can you set it through javascript. This is a security measure. If the browser allows you to do so, then it would be quite easy to steal user files.
hv a look this 1.in file upload page --------------------- <?php session_start(); ?> <input type="file" name="uploadedfile" value="<?php echo $_session['filepath']" ?>/> 2.in action page --------------------------- <?php session_start(); $_session['filepath']= $_FILES['uploadedfile']['name']; ?>