mercredi 17 juin 2020

Multiple Image upload using Laravel 5.6

I'm using dynamic input generate function through that I try to upload multiple images upload I got code from the internet and I modified according to my requirement images uploading is working when I the name into the table that time only I'm getting issues.

I can't understand how to do that. Please help how to do that.

I attached my codes, UI, table screenshot.

Inserting Code

$Colorimages=array();


            if($files=$request->file('Colorimages'))
            {

                foreach($files as $file)
                {
                    $extension = $file->getClientOriginalExtension();
                    $filename = date('YmdHis').rand(1,9999).'.'.$extension;
                    $file->move(public_path("product_images/sub_images"), $filename);
                    $Colorimages[]=$filename;
                }

            }

if(count($request->prol_product_line_code)>0)
        {
            foreach ($request->prol_product_line_code as $prol=>$v)
            {
                $data2=array
                (
                    'prol_product_code' => $request->prod_product_code,
                    'prol_product_line_code' => $request->prol_product_line_code[$prol],
                    'prol_printed' => $request->prod_printed,
                    'prol_color' => $request->prol_color[$prol],
                    'prol_image1' => $Colorimages[$prol],
                    'prol_image2' => $Colorimages[$prol],
                    'prol_image3' => $Colorimages[$prol],
                );
                product_line::insert($data2);
            }
        }

enter image description here

enter image description here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ec6bfm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire