FutureWeb's avatar

Multiple image upload in the same form

Hi Lara Folks ,

I am building a Livewire component and want to offer multiple image upload is this possible ?

model Car and CarImages say

so the component would let you fill out a form for the car information make, model, millage and at the same time add multiple images of the car car_id, image_url

I guess I need to call a function on wire click to store each image but need to ensure the Car model has stored first as I will require the car_id - it would be good to build an array of images and only post them to the Livewire model when finished and store all images at once.

0 likes
2 replies
FutureWeb's avatar

I've set a simple boolean $carCreated = false; when the car is created $this->carCreated = true; and can use this in the livewire view to display the upload form @if($carCreated) /** show the upload form*/ @endif this works great.

So just the multiple image upload to go :)

Please or to participate in this conversation.