up
May 15, 2019
14
Level 2
Upload Image not saved at directory on server Laravel 5.8
I deploy my website , and i have a bug on my upload image , this image cant saved at directory
my directory is in
in public_html on folder named files
on localhost its not having problem but after i deploy this , i have it .
my Controller on my localhost (not have problem like this)
public function store6(Request $request)
{
$this->validate($request, [
]);
if($request->hasfile('image'))
{ $file = $request->file('image');
$name=$file->getClientOriginalName();
$file->move(public_path().'/files/', $name);
$data = $name;
}
$user = new pemeliharaan;
$id = Auth::user()->id;
$user->user_id = $id;
$user->alat_id = $request->alat_id;
$user->pertanyaan =json_encode($request->except
(['_token','name','alat_id','status','catatan','image']));
$user->catatan = $request->catatan;
$user->image=$data;
$user->status = $request->status;
$user->save();
// dd($user);
return redirect('user/show6')->with('success', 'Data Telah Terinput');
}
this image "name" saved on DB but this file not saved , cant someone correct my code ?
Please or to participate in this conversation.