Support the ongoing development of →
Requests Input Database
Last updated 2 years ago.

If you use an <input type="file" name="image" value="{{ $post->image }}"> in your post.edit view, browser won't allow you to set its value. (It would be a big security hole otherwise.)

What you can do is just show the header image (in an <img>) in your edit form, keep the file upload input for if user want to replace the image and handle it in update() method accordingly (delete old image file, move new one to public, update post->image field with new location).


Thank you Xum. I had considered doing that, but didn't know if that was the best way to handle that. Thanks for the direction :)


Sign in to participate in this thread!


Your banner here too?

Yelldon yelldon Joined 2 Mar 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.