I want to update some records. Though I didnot want update image and click on update buuton, It shows me error- "Call to a member function getClientOriginalName() on null"
Here is my controller public function update(Request $request) { $participants = new participants;
$file = $request->file("select_file");
if($request->hasfile("select_file"))
{
$file->move("public/images/",$file->getClientOriginalName());
}
$id = $request->id;
$First_name = $request->First_name;
$Last_name = $request->Last_name;
$Date_of_Birth = $request->Date_of_Birth;
$GST_no = $request->GST_no;
$email = $request->email;
$Mobile_No = $request->Mobile_No;
$Company_name = $request->Company_name;
$Address = $request->Address;
$State = $request->State;
$City = $request->City;
$Pincode = $request->Pincode;
$Country = $request->Country;
$Amount = $request->Amount;
// $Image = $request->Image;
$Image = $file->getClientOriginalName();
DB::table('participants')
->where('id',$id )
->update(['First_name'=>$First_name,'Last_name'=>$Last_name,'Date_of_Birth'=>$Date_of_Birth,'GST_no'=>$GST_no,'email'=>$email,'Mobile_No'=>$Mobile_No,'Company_name'=>$Company_name,'Address'=>$Address,'State'=>$State,'City'=>$City,'Pincode'=>$Pincode,'Country'=>$Country,'Amount'=>$Amount,'Image'=>$Image]);
$participants->update();
session()->flash('success','Data Updated successfully!');
return redirect()->back();
//return back()->with('error','Update Data successfully!');
}
view page
Image}}"> Image}}" alt="Image not Found" style="width:100px; height:100px;" />I want the data to be updated with previous image(since I donot want to update image).
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZmhIBp
via IFTTT
Aucun commentaire:
Enregistrer un commentaire