I'm trying to upload a file, but it fails when the request lands to the controller.
With fails i mean that if i try $request->hasFile("filename")
always returns false.
Is there some specific field that I have to specify in the view?
This is a snippet of the view:
<body>
<form action="{{url('dev/tester')}}" method="POST">
{{csrf_field()}}
<input type="file" name="file">
<button type="submit">Test</button>
</form>
</body>
And here is the controller
class Tester extends Controller
{
public function index(Request $request)
{
if($request->hasFile('file'))
{
dd('Got the file');
}
dd('No file');
}
public function testView()
{
return view('tests.file_upload');
}
}
I always get returned 'No file'.
Any clue? I've even check the php.ini to see if there was a size limitation but it's all set to 32M as MAMP's pro default settings...