mercredi 26 août 2015

Laravel POST Dropzone Programatically

I have created a div: <div id="avatar" background-image:url('/avatar.png')">

I also used jQuery

  $( document ).ready(function() {
     $("div#avatar").dropzone({ url: "{{ url('/avatar')}}"});
   });

It was working but I was receiving TokenMismatchError, so I added this code too:

Dropzone.options.avatar = {
    sending: function(file, xhr, formData) {
        formData.append("_token", "{{{ csrf_token() }}}");  
   }
 };

When I view:source, I can see the token but when I post, I still get a TokenMismatchError.

View-source:

formData.append("_token", "ra4yjV9WclT6uwQn2KsuPdHjS4T2cDAWAvRDfpbR");



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1fGZJh1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire