Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pimous's avatar

Music upload TokenMismatchException

Hi, I would like to upload some music, my system works with the image file but with the music file I have this error : TokenMismatchException in VerifyCsrfToken.php

 {!! Form::open(array( 'route' => 'admin.music.store', 'class' => 'form', 'novalidate' => 'novalidate', 'files' => true)) !!}

<input type="hidden" name="_token" value="{{ csrf_token() }}">
{!! Form::label('link', 'Music (.mp3)') !!}
{!! Form::file('link',['class' => 'form-control fileform']) !!}
<button type="submit" class="btn btn-primary btn-lg">Create</button>
    
{!! Form::close() !!}
0 likes
4 replies
edstevo's avatar

I have had this error several times before..

It has been a combination of many factors, including:

  1. A correct and valid APP_KEY
  2. Correctly configured cookies
  3. Having the correct cookie / token (this one is an easy browser refresh)
  4. General tinkering and hoping.

However, looking quickly at your code you don't appear to be passing a value into the _token field

So, try:

<input type="hidden" name="_token" value="csrf_token()"> (With blade brackets)

instead of

<input type="hidden" name="_token" value="">
1 like
pimous's avatar
pimous
OP
Best Answer
Level 2

I solved the problem. I change the configuration of the php.ini file like that :

post_max_size = 4G upload_max_filesize = 2G

bashy's avatar

Will you have an extra 2GB for normal POST data? Seems a bit high to me but it's up to you.

Please or to participate in this conversation.