Page 1 of 1

File Input Field -> Remember the filepath on reload??

Posted: Thu Sep 28, 2006 7:24 pm
by seodevhead
Hey guys... just like when you have regular text field form elements that have the ability to "remember" what you put in them on reload (just in case you forgot to fill something out and didn't want to lose all your other input data) like below:

Code: Select all

<input type="text" name="lastName" value="<?php
if (isset($_POST['lastName'])) echo $_POST['lastName']; ?>" />
..How do you do the same with a file input field for attaching files? (ie. <input type="file" name="upload" /> )

Everything I have tried doesn't seem to be reloading that file attachment path from the user's computer in those file field elements on a page reload... so the user has to "re-attach" those files one by one again. Any idea how this can be done? Thanks a bunch.

Posted: Thu Sep 28, 2006 7:35 pm
by printf
You can't load a file input, it's a security feature built into the browser! You could just allow the upload and store it in a temp place. Then move it when the other parts of the form are corrected. Then setup a cron to dump all the temp files that were not moved because the user didn't finish filling in the form. This is best way if your dealing with bigger files, so the user doesn't have to upload the file again...

me!