Closed derrandz closed 6 years ago
Hi, i think this will help you $("#drop-area-div").dmUploader({ url: '/upload/image', extraData: { _token:'{{ csrf_token() }}' }} );
So there is an extraData indeed, I'll retry with that bug when time is allowing, thank you.
Hey @jshrt and @etmind I dont have any problem using this
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
});
and I have in my
the meta tag<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
so you dont need use extraData I know that this issue is time time ago haha but maybe this help to others!! :D
regards!
I do not remember when this was exactly, but I'll definitely go with a header specification rather than some other attribute that is specific to a component.
Thanks @blenderdeluxe
Closing the issue.
With the new release there is a new headers
option to provide something like this.
In addition to that, extraData can now be a function itself and return a collection of data too. Use-full for dynamic values that may change each request.
extraData: function(){
return {
galleryid: $('#albumPicker').val();
};
}
I switched from dropzone to this and I like it, however I thuoght I could manipulate the ajax data sending how I wanted, which seems to not be true.
Laravel forms need a csrf token to be verified.
Although I have it in my form, I still did get the 'tokenMisMatch' error, which made me conclude that this plugin does send only files input...
How do I manipulate the request to take all of the forms input, and send it onclick, and autoqueued as is here by default?
I believe it is via the extraData option... but how?