0

I'm working with Laravel File System. I have done up-to File upload and show from database. Now, I'm facing problem when i'm try to update file in database. I can not load file in

<input type="file" value="{{$file->name}}>" this way, it's show null. How Can i do this stuff. Here is my view part.

  <form class="" action="{{route('file.update',$file->id)}}" method="post" enctype="multipart/form-data">
    @csrf
    <input type="hidden" name="_method" value="PUT">
    <input type="file" name="image" value="{{$file->name}}">
    <br>
    <input type="submit" name="" value="update">
  </form>

and Here is my Controller part.

  public function edit($id)
{
  $file=File::find($id);
  return view('uploads.edit',compact('file'));
}
public function update(Request $request, $id)
{
  return $request->file('image');
}
Majeed
  • 149
  • 1
  • 3
  • 16

2 Answers2

0

You cannot define value for

Usually in this case coders just show image or filelink to old file.

Dry7
  • 861
  • 1
  • 8
  • 17
0

I suggest you may use Laravel Filestorage see documentations here.

Mcfaith
  • 269
  • 4
  • 16