I have a Laravel application and a form with dropzone. Normally , it works well. But when i try to upload large files ( 50M - 60 M), I get this error TokenMismatchException
.
I'm using this code to send token :
formData.append("_token", $('[name=_token]').val());
I also changed all php.ini settings:
max_upload_size
set_time_limit(0);
memory_limit
post_max_size
max_input_time
As said above, it's working for small files.
I solved the issue. It's because of php.ini
file. I edited and saved php.ini
but it didn't effect the output of phpinfo();
function. Output was showing old values. Check this link for solution :
Changes to upload_max_filesize in Ubunutu php.ini will not take effect
If you have changed all the php settings, that should not be an issue. However, if this is being done over AJAX, then appending a _token
to the request is messy and hacky. Instead, set the {{ csrf_token }}
as your request header. More specifically, set it on the X-CSRF-TOKEN
header, since Laravel checks for that in the middleware.