You can't repopulate <input type="file">. It's just not allowed in the HTML spec, otherwise you could inject all sorts of malicious files into the users browser. The file must be chosen by the user, each time.
Apr 15, 2018
6
Level 1
help !!! how i can keep the image uploaded in edit page
<div class="row">
<div class="col-3">
<div class="c-field">
<label for="">Image : </label>
<input type="file" name="imagepath" value="{{ $post->image_path }}">
</div>
</div>
<div class="col-9">
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid">
<label for="">Tags : </label>
@foreach($tags as $tag)
<label><input
@foreach($post->tags as $t)
@if($tag->id == $t->id)
checked
@endif
@endforeach
class="uk-checkbox" type="checkbox" name="tag[]" value="{{ $tag->id }}"> {{ $tag->tag }} </label>
@endforeach
</div>
</div>
</div>
Level 15
You probably want to populate an hidden input and use this instead for future requests .. so check for either the real file input or the hidden input.
This only assumes that you temporarily save the file somewhere after the upload (if something goes wrong) so that you can reference it during the next request.
session should also work
1 like
Please or to participate in this conversation.