Upload Images

Upload Single Image

if($request->file('reg_photo')){                                     // Uploading Registration photo
                $tmpFilePath = public_path('/assets/images/reg-photo/');
                // echo $tmpFilePath; die();
                $p_hadPath ='reg-photo_'.time();
                $img = Image::make($request->file('reg_photo'));
                $img->save($tmpFilePath.$p_hadPath.'.jpg');
                $reg_photo = $p_hadPath.'.jpg';
            }

Upload Multiple Images

        $arr_degree_photo = [];

        $degree_photo = $request->file('degree_photo');

foreach ($degree_photo as $file) {
                //   echo $name = $request->file('doctor_photo')->getClientOriginalName(), '.' . $request->file('doctor_photo')->getClientOriginalExtension();
                $doctor_degree_name = date('dmY') . microtime() . '.' . $file->getClientOriginalExtension();
                $arr_degree_photo[] = $doctor_degree_name;
                $destinationPath = public_path('/assets/images/degree-photo');
                $file->move($destinationPath, $doctor_degree_name);
            }

Comments

Popular posts from this blog

Image Upload PHP Core or OOPs

Xampp Customization