you can not show file in your file input
you need to apply it on this way
// in your controller function
$filePath = storage_path().'/documents/mid_year/'.$goal->employee_mid_year_attachment;
$fileType = $this->getFileType($filePath);
return view('view-name', compact('goal', 'filePath', 'fileType'));
// create this function in your controller or any repo where it could be access
protected function getFileType($path) {
$image_extensions = ['jpg', 'jpeg', 'gif', 'png'];
$info = pathinfo($path);
$fileType = $info['extension'];
if(in_array($fileType, $image_extensions))
{
return 'image';
}
return 'other';
}
// in your blade file
<div class="custom-file">
<div class="custom-file">
@if($fileType == 'image')
<img srs="{{ $filePath }}" title="{{ $goal->employee_mid_year_attachment }}" >
@else
<img srs="{{ storage_path('app/file-icon.opg') }}" title="{{ $goal->employee_mid_year_attachment }}" >
<span>{{ $goal->employee_mid_year_attachment }}</span>
@endif
<input value="{{ old('employee_mid_year_attachment') }}" type="file" name="employee_mid_year_attachment" class="custom-file-input" id="customFile">
<label class="custom-file-label" for="exampleInputFile">Choose file</label>
</div>
</div>