Reputation: 351
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!
Upvotes: 2
Views: 15242
Reputation: 412
The folder will be uploaded to /storage/app/uploads/. You can specify a symlink in config/filesystem.php
note- copied verbatim from a comment by Qirel on the original question - but it seems that this should be an answer and not a comment. So I'm posting this as Community Wiki.
Upvotes: 2