Level 3
Did you set the 'files' => true attribute in your form? Like so:
{!! Form::open(['url' => '/upload/xsm-equi', 'files' => true]) !!}
2 likes
When I try to upload a file it is returned as an string rather than a file object. If checked and rechecked my code. So is it something I'm doing wrong or what??
Controller
public function update($id, ProfileRequest $request)
{
$profile = Profile::findOrFail($id);
if($request->hasFile('cv'))
{
$cv = $request->file('cv');
$filename = $cv->getClientOriginalName();
$cv->move(storage_path() . '/app/profiles', $filename);
}
$profile->update($request->all());
return redirect('profile');
}
Return Data
{
"nationality": "",
"mobile": "",
"street": "",
"area": "",
"city": "",
"country": "",
"state": "Western Cape",
"postal_code": "8000",
"home_tel": "",
"work_tel": "",
"interests": "Swimming, Gaming, Coding",
"can_work": "South Africa, United Kingdom",
"birthday": "1990-01-01",
"marital_status": "single",
"cv": "pp.jpg"
}
As you can see "cv" which is supposed to be an array is a string. Any help will be appreciated. I've been unable to solve this for two days now
Did you set the 'files' => true attribute in your form? Like so:
{!! Form::open(['url' => '/upload/xsm-equi', 'files' => true]) !!}
Please or to participate in this conversation.