简体   繁体   中英

Can't write image data to path in laravel 8 using the Intervention library

I'm Using Laravel 8 and I'm Facing this error.

Can't write image data to path (/home/u520518518/domains/dev.peacockindia.in/public_html/public/Backend/Image/Brand/2003012866_Brand-Image_Mobile_jpg)

This is My Code

if($request->logo){
    $image = $request->file('logo');
    $img   = rand().'_'.'Brand-Image'.'_'.$request->title.'_'.$image->getClientOriginalExtension();
    $loc   = public_path('Backend/Image/Brand/'.$img);
    Image::make($image)->save($loc);
    $brand->logo   = $img;
}
 $image = $request->file('image');
        $slug = Str::slug($request->name);
        if (isset($image))
        {
            $currentDate = Carbon::now()->toDateString();
            $imagename = $slug.'-'.$currentDate.'-'. uniqid() .'.'. $image->getClientOriginalExtension();
            if (!file_exists('storage/uploads/employee-images'))
            {
                mkdir('storage/uploads/employee-images',0777,true);
            }
            $image->move('storage/uploads/employee-images',$imagename);
        }else{
            $imagename = "default.png";
        }

I tried this

$loc   = 'Backend/Image/Brand/'.$img;

and its worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM