jeudi 3 octobre 2019

updated image stores in database but not folder in laravel

problem is that company_photo stores in database but not store in company_photos folder, please tell me where i going wrong..

public function update(Request $request, Company $company,CompanyOtherInfo $CompanyOtherInfo )

{
    //dd($company);
    //dd(request()->all());

   if($request->hasFile('company_photo')){

        $files=public_path().'/company_photos/'.$req->input('company_photo1');
        File::delete($files);
        //dd($files);
        $file = $req->file('company_photo');

        $destinationPath = public_path().'/company_photos/';
        $filename = $file->getClientOriginalName();
        $file->move($destinationPath, $filename);



       // echo  $filename;
        }
        else{
            $filename=$request->input('company_photo1');
        }

//dd($request); //dd($filename);

  $company::where('companies.company_id',$company->company_id)
                   ->update([

       'company_photo' => $filename,            
        'company_name' => request('company_name'),
        'company_email' => request('company_email'),
        'company_mobile' => request('company_mobile'),
        'company_country' => request('company_country'),
        'company_state' => request('company_state'),
        'company_city' => request('company_city'),
        'company_pincode' => request('company_pincode'),
        'company_address' => request('company_address'),
        'industry_id' => request('industry_id'),
        'segment_id' => request('segment_id'),
        'company_code' => request('company_code'),
        'contact_person'=>request('contact_person'),


        ]);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire