oxbir
1 month ago
230
7
Laravel

Undefined variable: data

Posted 1 month ago by oxbir

I want to upload multiple image with dropzone but I get this error.

public function dropzone(Request $request)
{
    if ($sliders = $request->file('sliders')) {
        foreach ($sliders as $slider) {
            $randomize = rand(1111111111, 9999999999);
            $extension = $slider->extension();
            $filename = $randomize . '.' . $extension;
            $slider->move(public_path('images/design-studios/'), $filename);
            $data[] = $filename;
        }
    }
    return $slider->sliders = $data;
}

I get this error.

data

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