Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to create directory in laravel 5.1 when upload image?

Error : Unable to create the "http:/localhost/shopping/public/src/img/" directory

my code :
$imageName = $product->id . '.' . 
        $request->file('image')->getClientOriginalExtension();
                $request->file('image')->move(
        url().'/public/src/img/', $imageName
        );
like image 550
سرين موسى Avatar asked Feb 28 '17 13:02

سرين موسى


1 Answers

Use the public_path() helper, not url():

->move(public_path('src/img/'.$imageName));
like image 60
Alexey Mezenin Avatar answered Oct 18 '22 08:10

Alexey Mezenin