use Livewire\WithFileUploads; class UploadPhoto extends Component { use WithFileUploads; public $photo; public function save() { $this->validate([ 'photo' => 'image|max:1024', // 1MB Max ]); $this->photo->store('photos'); } }
<form wire:submit.prevent="save"> <input type="file" wire:model="photo"> @error('photo') <span class="error">{{ $message }}</span> @enderror <button type="submit">Save Photo</button> </form>