1 week ago

Multiple image upload

Posted 1 week ago by Loyd

getting error Call to a member function move() on string on store method when uploading multiple images. My controller

public function store(CreatePostRequest $request)
        // dd($request->all());
        foreach ($request->image as $photo) {
            $imageName = $photo->getClientOriginalName();

            $imageUniqueName = $imageName.'_'.uniqid();

            $imagePath = $imageUniqueName->store('uploads/posts', 'public');  

             // use intervention image to resize images
            $imagePath = Image::make(public_path("storage/{$imagePath}"))->fit(1200, 1200);

            'caption' => $request->caption,
            'location' => $request->location,
            'slug' => Str::slug($request->caption),
            'image' => $imagePath,


        return redirect(route('profile.show', auth()->user()->slug));

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