Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

filepond remove file after upload

// 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();
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to decode base64 string of any extansion in angular 
Javascript :: script src in folder 
Javascript :: is focus vanilla javascript 
Javascript :: react video srcobject 
Javascript :: how to edit a fil with vanilla js 
Javascript :: javascript reduce function array 
Javascript :: Material-ui Adb icon 
Javascript :: strapi v4 populate 
Javascript :: replace in string all occurance jquery 
Javascript :: length array 
Javascript :: if isset handlebars js 
Javascript :: tagged templates 
Javascript :: react native fetch response code 
Javascript :: JS cast a Number into a String 
Javascript :: how to live reload a node js app 
Javascript :: javascript nullish 
Javascript :: discord js invite to channel 
Javascript :: how to display image in html from json object 
Javascript :: how to add key value pair in object 
Javascript :: how to add eventlister to multiple variable 
Javascript :: style.backgroundcolor 
Javascript :: gradle error react native 
Javascript :: Each then() should return a value or throw 
Javascript :: textbox value length in javascript 
Javascript :: how to search for react icons on vscode 
Javascript :: visual studio node.js mac 
Javascript :: how to add class in javascript dynamically 
Javascript :: input element change event data 
Javascript :: Get title assert 
Javascript :: ejs layout 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =