Problem: unable to see file image upload data. Getting null returned
Im trying to post an ad and i would like to see the data that i'm posting
So my form looks like so:
{!! Form::open(['data-remote', 'class' => 'form-vertical', 'route' => 'dashboard.ad.create', 'files' => true, 'id' => 'createAd']) !!}
<div class="cover_photo">
{!! Form::label('cover_photo', 'Cover Photo') !!}
{!! Form::file('cover_photo') !!}
</div>
{!! Form::close() !!}
This is the field with the issue, the file form field named cover_photo
My form request class has the following in the rules array
'cover_photo' => 'image',
I'm using ajax to post the form. All im doing in my controller is
public function postStoreAd(PostAnAddRequest $request) {
dd($request->all());
}
Here's the response for request->all(). I don't even see cover_photo
dd($request->all());
array:14 [
"_token" => "nsiJLjvS6K2mFKpTpqQFFgYJRPWqVSeag68Lluce"
"title" => "A beautiful apartment for sale"
]
The weird thing is i get all the other form fields data. Except for cover_photo
In fact when i try to do the following i get null:
dd($request->file('cover_photo')); // returns null
I've ensured that i'm using the
'files' => true, // In my Form::open()
Please help and thank you :)