4 months ago

Upload Multiple Product Images

Posted 4 months ago by rabintamu

I am still learning laravel. I want to upload multiple images for my products but with this code i can upload only one image, help me to upload multiple images with this code.

public function store(Request $request)

    $details = request()->validate([
        'image' => ['required', 'image'],
        'title' => 'required',
        'price' => 'required',
        'description' => 'required',
        'location' => 'required',

    $imagePath = request('image')->store('uploads','public');
    $image = Image::make(public_path("storage/{$imagePath}"))->fit(1200,1200);

    'title' => $details['title'],
    'price' => $details['price'],
    'description' => $details['description'],
    'location' => $details['location'],
      'image' => $imagePath

    return redirect('/profile/' . auth()->user()->id);

Please sign in or create an account to participate in this conversation.