I get error in image upload preview

I get this error in image upload preview while the same procedure in another package is ok:

Call to a member function temporaryUrl() on string


      <img src="{{ $photo->temporaryUrl() }}">
    <input type="file" wire:model="photo">


  use WithFileUploads;

  public $photo;

    public function render()
        return view('livewire.coach-new');

Do you get this error on first render or after you’ve uploaded a file? You may need a different blade if statement. Try:

@if ($photo->temporaryUrl() !== null)
    <img src="{{ $photo->temporaryUrl() }}">
1 Like

Thank you. I reinstalled the Laravel packages and replaced Models and … and the problem solved !