oxbir
2 months ago
170
4
Laravel

Undefined variable: image_name

Posted 2 months ago by oxbir

I want to upload and display image, but i get error Undefined variable: image_name

    if ($request->hasFile('image')) {
        $image = $request->file('image');
        $image_name = $image->getClientOriginalName();
        $image->move(public_path('images/images'), $image_name);
    }
    Style::create([
        'style_name' => $request->style_name,
        'image' => $image_name,
        'email' => $request->email,
        'style_logo' => $filename,
        'founder' => $request->founder,
        'website' => $request->website,
    ]);

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