I have created a livewire component Avatar with the contents:
use Livewire\Component;
use Livewire\WithFileUploads;
class Avatar extends Component
{
use WithFileUploads;
/**
* @var \Livewire\TemporaryUploadedFile
*/
public $photo;
public function updated()
{
$this->validate([
'photo' => [
'image',
'max:4096',
],
]);
$file = $this->photo->store('upload');
}
public function render()
{
return view('livewire.profile.avatar');
}
}
Here's the view:
<div>
<div class="card">
<div class="card-body">
<form>
<input type="file" accept="image/*" wire:model="photo">
</form>
</div>
</div>
</div>
I am not sure what I am missing but this is not uploading to my public directory in my Laravel app. Anyone can give me some help? Thanks!