I'm trying to upload multiple images at the same time and after the request, display them on the same page, beneath the form such that later (after multiple uploads) I can select which pictures i would like to keep. I used all the posible answers found here ([How to upload multiple files using PHP, jQuery and AJAX](https://stackoverflow.com/questions/19295746/how-to-upload-multiple-files-using-php-jquery-and-ajax),  

[Uploading Multiple Files using AJAX and PHP](https://stackoverflow.com/questions/42394069/uploading-multiple-files-using-ajax-and-php) ) , but no success. 

I keep getting TokenMismatchException

500 (Internal Server Error) + TokenMismatchException in VerifyCsrfToken.php line 68:

Any ideas?

Here is my code:

HTML:

```
<form id="uploadForm" enctype="multipart/form-data">
   <div class="container upload-picture-device">
      <div class="col-md-2 col-sm-1 col-xs-12"></div>
         <div class="col-md-4 col-sm-5 col-xs-12">
             <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-btn">
                            <span class="btn btn-de-pe btn-file">
                                Choose <input id="fileInput" type="file" name="files[]" class="pics" multiple>
                            </span>
                        </span>
                        <input type="text" class="form-control input-upload" readonly>
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    </div>
                </div>
            </div>
            <div class="col-md-4 col-sm-5 col-xs-12 text-left">
                <button id="uploadPhotos" type="submit" class="btn-continua">Upload picture</button>
            </div>

        </div>
        </form>

```

Javascript:

```
$('#uploadForm').submit(function (e) {
    e.preventDefault();

    var form = new FormData();
    var files = document.getElementsByClassName('pics');
    for (var i=0; i<files.length; i++) {
        form.append("files[pic" + i + "]", files[i][0]); // add receipt to form
    }
    form.append('action', 'upload-photos'); // specify action

    $.ajax({
        url: '{{url("/photos/device")}}',
        type: 'POST',
        data: form,
        cache: false,
        processData: false,
        contentType: false,
        success:function(data) {
            console.log(data);
        },
        error: function(xhr, desc, err) {
            // I have some error handling logic here
        }
    });
});

```