darkblue Posted February 22, 2007 Share Posted February 22, 2007 Dear all, I have a spot of bother with a PHP file upload form. Basically I have a file upload field and some other assorted fields. Each of these fields run some server side validation. The problem arises when one of the other fields does not pass validation. How can I get the data input in the file field to remain in the field? I've tried: <form <snip>...</snip>> <snip>...</snip> <input type="file" name="filename" value="<?=$_POST['filename'];?>" /> <input type="text" name="otherfield" value="<?=$_POST['otherfield'];?>" /> </form ...and... <form <snip>...</snip>> <snip>...</snip> <input type="file" name="filename" value="<?=$_FILES['filename'];?>" /> <input type="text" name="otherfield" value="<?=$_POST['otherfield'];?>" /> </form ... but neither have the desired effect. Does anyone know what I need to do to get the previous file selected to persist in the file field on reload, or if this is even possible? Cheers. Link to comment https://forums.phpfreaks.com/topic/39626-solved-persistence-of-input-typefile-fields/ Share on other sites More sharing options...
kenrbnsn Posted February 22, 2007 Share Posted February 22, 2007 You can't with PHP. You might be able to do that with Javascript. Ken Link to comment https://forums.phpfreaks.com/topic/39626-solved-persistence-of-input-typefile-fields/#findComment-191255 Share on other sites More sharing options...
darkblue Posted February 22, 2007 Author Share Posted February 22, 2007 Not the answer I was looking for... Thanks anyway. Link to comment https://forums.phpfreaks.com/topic/39626-solved-persistence-of-input-typefile-fields/#findComment-191277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.