Do you have enctype='multipart/form-data' or if using collective Form facade 'files' => true?
Nov 7, 2016
4
Level 2
[L5.3] File Upload issue with Ajax/jQuery
Hey Folks, I got an issue when I want to make a fileUpload with Ajax. I got all running, but my Request instance is allways null.
Here a small snippet from my Action:
public function addPhoto(Request $request)
{
return dd($request->file); // Is allways empty when I use it with AJAX
return dd(Illuminate\Support\Facades\Input::all()); // This works fine with Ajax, but I want to use $request ;)
}
My Request instance is allways NULL, that makes me crazy. Input::all() has all data, but I found it a bit messi. I want to use the $request to build something like this: $request->file('photo')->store( ) etc. Maybe anyone of you know what I'm doing wrong.
Please or to participate in this conversation.