htmllaravelformsimageuploading

How to display a uploaded image path in my input (laravel)


When the user wants to edit its own post, I want the current uploaded image to show up in the input field. I have tried to pass the path of the image from the database to the value of the input. But somehow it does not showing up.

<input type="file" name="image" value="{{ $posts->image_path }}>

I have checked which data this pass to the view and it is correct. In the image below you see the path dumped to the page, but I want it in the input field, so if the post changed I don't have to upload the same image again.

enter image description here


Solution

  • You can't show the image directly in the Input file (this is not supported). You can, however, display it directly next to it in an img tag