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

Hemir's avatar

TokenMismatchException with uploadify on firefox

Hi,

i'm using the plugin js "uploadify". It's work on google chrome but with firefox, i get "error 500". After some research i found the problem comes from Csrf token (middleware VerifyCsrfToken). I dont understand why it's work on chrome and dont on firefox.

My jquery script to call uploadify plugin is

<script type="text/javascript">
        <?php $timestamp = time();?>
        $(function() {
            $('#file_upload').uploadify({
                'formData'     : {
                    'method' : 'post',
                    'timestamp' : '{!! $timestamp !!}',
                    '_token'     : '{!! csrf_token() !!}'
                },
                'swf'      : '{!!asset("js/uploadify/uploadify.swf")!!}',
                'uploader' : '{!! asset("uploadify")!!}',
                'buttonText' : 'Votre logo'
            });
        });
    </script>

Thx for your help.

PS : sorry for bad english.

PS2 : Laravel 5.0

0 likes
1 reply
Hemir's avatar

Hi, i will up this post because i havn't solution

I debug my middleware and i get

$token = chbeVVpy5oyE3p1IDe4TzHFNJwEzZ7I6xnk9d03R
$request->session()->token() = wW2S9zf1Xo82DxdmjXj0j5zubSWKhvadeRG20cmv

I get the $token value from the helper csrf_token (like above)

It happens only on mozzila firefox. With google chrome, both values are equals.

I'm lost, someone can help or explain me pls ? Why my helper crsf_token differs from my session token ?

Please or to participate in this conversation.