Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fine uploader TokenMismatchException in Laravel 5

Tags:

laravel

How I can add this input:

<input name="_token" type="hidden" value="{!! csrf_token() !!}" />

to FineUploader without creating a form?

like image 536
Jensej Avatar asked Feb 10 '23 13:02

Jensej


1 Answers

You have probably solved your problem since but this might help other people coming accross this thread. The following worked for me :

in <head> :

<meta name="csrf-token" content="{{ csrf_token() }}" />

Then initialize you fineUploader as follow :

var manualuploader = new qq.FineUploader({
    request: {
        endpoint: "path/to/your/server",
        customHeaders: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    }
});
like image 98
Youmdingding Avatar answered Feb 15 '23 09:02

Youmdingding