I´m trying to upload image with filepond
library. Mi problem it´s that return 419 error
to build my component in vue, i´m trying with this code:
<file-pond
name="back_dni"
ref="pond"
class-name="my-pond"
label-idle="DNI trasero"
allow-multiple="false"
accepted-file-types="image/jpeg, image/png"
v-on:init="handleFilePondInit"
server="/commercial/uploadDocuments"
/>
In my script, i have example that it´s write in documentation:
all import to create Filepond
…..
// Create FilePond component
const FilePond = vueFilePond(FilePondPluginImagePreview,FilePondPluginFileValidateType);
setOptions({
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
server: {
process: {
url: '/commercial/uploadDocuments',
method: 'POST',
withCredentials: false,
onload: (response) => response.key,
onerror: (response) => response.data,
ondata: (formData) => {
formData.append('Hello', 'World');
return formData;
},
},
revert: './revert',
restore: './restore/',
load: './load/',
fetch: './fetch/',
}
});
export default {
name: 'uploadDniBack',
data: function () {
return {
myFiles: []
};
},
methods: {
handleFilePondInit: function () {
// example of instance method call on pond reference
this.$refs.pond.getFiles();
},
},
components: {
FilePond,
},
};
I´m sending headers with token, but i don´t know if i can send this data so.