0

I have stored form values along with image_url. I have to edit them,so that I fetched data from database. Now, I want to assign dynamic value to the input type file,so that user will understand which file is selected. If I don't browse file again and hit Save button then it shows undefined variable error.
What I have tried so far -

 <img id='feature_img' src="<?php echo base_url('assets\\')."upload\\".$feature_img ?>"> //To display Image         
 <label for="edit_feat-img" class="custom-file-upload">
    <i class="fa fa-cloud-upload"></i> Update
 </label>
  <input id="edit_feat-img"name='featured_img'type="file"style="display:none;"> //If I dont browse file again it shows undefined variable.  

What I want, if I don't select file, then it should take the dynamic value which I want to assign to input type file, so that undefined variable error will not be occured.
How is this possible?
Thanks.

amM
  • 509
  • 2
  • 14
  • 33
  • Possible duplicate of [How to set a value to a file input in HTML?](http://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html) – jtheman Jan 09 '17 at 13:42
  • 1
    You can't due to security concerns. My best idea is to show the filename besides the file type input to notify the user. – jtheman Jan 09 '17 at 13:44

0 Answers0