FilePond удалить файл после загрузки
// clear file input filepond multiple
// example: (I using alpine.js)
const post = FilePond.create($refs.fileinput, {
acceptedFileTypes: ['image/jpg', 'image/jpeg', 'image/png', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
labelFileTypeNotAllowed: 'File type not allowed ',
fileValidateTypeLabelExpectedTypes: 'Allowed file type: .jpg, .jpeg, .png, .xlsx, .xls, .pdf, .docx',
fileValidateTypeDetectType: (source, type) =>
new Promise((resolve, reject) => {
resolve(type);
}),
maxFileSize: '20MB',
allowMultiple: true
});
post.setOptions({
server: {
process:(fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
@this.upload('filearray', file, load, error, progress)
},
revert: (filename, load) => {
@this.removeUpload('filearray', filename, load)
},
},
onprocessfile: function(error, file) { // remove file where has been uploaded one by one
post.removeFile(file);
},
// or
onprocessfiles: function(){ // remove file where all has been uploaded
post.removeFiles();
}
});
hirohito