I had the same error when uploading files which were to large for my server. I'm not sure why you get the error even though your max is 2G, but I can give you a solution (sort of).
The reason you get a TokenMismatchException is that somehow the server clears all of the $_POST and $_GET variables. I couldn't find a way to ignore this behavior, so I made a filter which will throw a more appropriate exception when the the uploaded file is to large.
https://gist.github.com/MarkRedeman/9125186
So it's not really a solution to your problem, but at least you will get a more appropriate exception.
Thank you. At least it's not me going crazy thinking I don't have a parameter set properly. Now I know what the issue is. Unfortuatenly I think I'm going to have to disable the CSRF for this form to get this to work for now.
if you upload more then your server's post_max_size
setting the input will be empty, hence a token miss-match
so if you have 2 upload input's in your form and your upload_max_filesize
is 2G, your post_max_size
needs to be at least 4G
Woot! That did it! Thank you! Would never have guessed that!
Thank You!!!
Spent literal hours thinking that I had a weird bug. I'm surprised Laravel doesn't have a built in exception error for files that are too large. Finally, I can move on with my project!
On thing that happened to me.
In case you are running php server with php -S, restart it to let php.ini changes take effect.
I was running it and restart apache server, but I was actually using php -s command.
I hope it saves someones time.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community