I can't upload excel file in Laravel 5.
I have following error:
TokenMismatchException in VerifyCsrfToken.php line
View
<form action="{{url('raports/upload')}}" method="post" enctype="multipart/form-data">
<input name="_token" type="hidden" value="{!! csrf_token() !!}" />
<input type="file" name="plik" >
<input type="submit" class="btn btn-primary" value="Upload File"/>
</form>
Controller
public function postUpload()
{
$validator = Validator::make(Request::all() , ['plik' => 'required']);
if ($validator->fails()) {
return redirect('raports/upload')
->withErrors($validator)
->withInput();
}
else
{
$file = Request::file('plik');
dd($file->getClientOriginalName());
}
}
When I try upload txt file everything is OK, but not with excel files.
Any ideas?
Maybe it is a problem from nginx:
2015/12/09 19:30:32 [error] 24145#0: *1233663 FastCGI sent in stderr: "PHP message: PHP Warning: REQUEST_BODY_FILE: open('/var/lib/nginx/body/0000007523') failed: No such file or directory (2) in Unknown on line 0" while reading response header from upstream, client: 91.226.23.2, server: domain.com, request: "POST /raports/upload HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"