Closed smilemakc closed 4 years ago
Yes this is the correct one,
For those who are confused doing a custom UploadAdapter, this.loader.file
is a Promise, an example of my implementation with Axios upload
const app = new Vue({
el: '#app',
data () {
return {
UploadAdapter: (loader) => {
loader.upload = () => {
return loader.file
.then(file => new Promise((resolve, reject) => {
const body = new FormData();
body.append('file', file);
return axios.post(url, body,
{headers: {'Content-Type': 'multipart/form-data'}}
)
.then(response => {
resolve({
default : response.data.link
});
})
.catch(error => {
console.log(error);
reject(error);
});
}));
}
loader.abort = () => {
console.log('Abort upload.')
}
}
}
}
});
Dear Sir, I am implementing this during sending email with laravel. Using this UploadAdapter method, in post request I am keeping images in a folder of my project. Suppose, I uploaded a wrong image or file and instantly decided to remove this image or file then, removing it using keyboard delete key or some how. But problem is, when I uploaded the image or file it is moved to the specific folder of my application already. What should be the process to remove also this image or file from my folder too. Would you help me please!
Official API was changed.
Read official documentation.
Create custom build with your Adapter implementation.
https://github.com/igorxut/vue-ckeditor5/blob/046b9a83dbac67965d9091b26695c0c9f411d904/examples/example3/index.html#L38
I think that's the way.
this.loader.file.then(file => { body.append('file', file, file.name); })