I have a function to upload files. on Localhost it's not having an error. but after I deploy on shared hosting, its have a problem. If localhost, I'm not moving some folder, but on "tutorial" shared hosting, I need to make 2 folders. Laravel and public. this Laravel folder is all file on project Laravel without public
It's my schema on my shared hosting
(/home/sippausr)
etc
Laravel ->
app
bootstrap
config
database
public_html
- files ( this file saved here)
resources
routes
storage
tests
vendor
logs
public_ftp
public_html ->
css
files (not on here, i need to save here)
home
images
js
kalibrasi
public
sop
theme
And I have a function to upload a file and saved this file to directory files on public_html 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');
}
But, this file not saved at public_html/files
,
This file saved in the Laravel folder, on public_html( you can see at schema). Can someone help me?