Search code examples
phphtmlcodeignitercodeigniter-2

Make data not disappear from file field using codeIgniter


I have filled 10 fields out of 11 fields including selected the file for upload the document. after submitting, the error is a message showing one field data is required at the same time the file field document value also disappeared.

I am using the following method but still, value is disappeared while clicking submit button.

<input  class="form-control" type="file" class="form-control" id= "userfile" name= "userfile" value="<php? echo set_value('userfile');?>">

Kindly help me to rectify the same.


Solution

  • You can not keep the selected file. You can read about it and what you can do about it here.

    Another solution - You can implement a step by step process. In the first step, you can get text inputs and validate them. If it succeed, then you can continue to the image upload page.