jQuery File Upload showing TokenMismatchException on Laravel

101 views
Skip to first unread message

Goran Ljubas

unread,
Feb 5, 2016, 9:18:11 AM2/5/16
to jQuery-File-Upload

I'm trying to work with jQuery File Upload and Laravel, everything works fine but when I start uploading file it shows TokenMismatchException.

    <form id="fileupload" action="upload" method="POST" enctype="multipart/form-data">
        <span class="btn green fileinput-button">
           <i class="fa fa-plus"></i>
        <span> Add files... </span>
        <input type="file" name="files[]" multiple=""> </span>
        ...
        ...
    </form>

Controller

public function upload(Request $request) {
    dd($request);
}

I tried including

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

But then it shows another error:

Error SyntaxError: Unexpected token <

Oyewole ABAYOMI S.

unread,
Feb 6, 2016, 6:52:25 AM2/6/16
to jQuery-File-Upload
What version of laravel are you using???

Raphael de Almeida

unread,
Mar 5, 2016, 1:07:43 PM3/5/16
to jQuery-File-Upload
In Laravel 5 you need to add {{ csrf_field() }} on template-download and template-upload
Reply all
Reply to author
Forward
0 new messages