I want to have a button where a client can view an applicant's document that the candidate has uploaded, but for some reason I cannot figure out why it doesn't work.
It was working fine offline, but I deployed the site via FTP today and It doesn't want to work.
I am less than a junior developer so please be kind about messy code,
Here is my code for
upload blade:
<form action="{{route('cv')}}" method="POST" enctype="multipart/form-data">@csrf
<div class="card">
<div class="card-header">Update CV</div>
<div class="card-body">
<input type="file" class="form-control" name="cv"><br>
<button class="btn btn-success float-right"
type="submit">Update</button>
@if($errors->has('cv'))
<div class="error" style="color: red;">{{$errors->first('cv')}}</div>
@endif
</div>
</div>
Code for route:
Route::post('user/cv','UserController@cv')->name('cv');
Code for Controller:
public function cv(Request $request){
$user_id = auth()->user()->id;
$cv = $request->file('cv')->store(public_path('storage/files'));
Profile::where('user_id',$user_id)->update(['cv'=>$request->file('cv')->getClientOriginalName()]);
return redirect()->back()->with('message', 'CV Successfully Updated!');
}
Code for viewing the CV :
<a href="{{Storage::url($profile->cv)}}" class="btn btn-outline-primary">View my CV</a>
When I click the button I get this url:
cvroad.co.za/storage/Kevin%20Breed.pdf
The name of the file is : Kevin Breed.pdf and that is how it is seen in my database aswell.
but still 404 not found?
Any and all help would be appreciated, thank you!