I want my previously uploaded file to be automatically selected while I am editing details which also include file upload. I have used value attribute as in other types. But this doesn’t work.
<input type="file" name="file" value="<?php echo $news['image']; ?> ">
I have to select the required file again while I am editing details. No file is selected as default while editing. I want to edit other details but not the file upload.
What can I do so that I do not have to select it again?
Advertisement
Answer
You can display image using
<img src="path/<?php echo $news['image']; ?>">
or if it is a file use the
<a href="path/<?php echo $news['my_file']; ?>">My File</a>
tag to link.
When you update the DB make sure you update the field image only when the new file is selected.