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 :: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds. 
Javascript :: jse api 
Javascript :: correct way to push into state array 
Javascript :: ejemplo async await javascript 
Javascript :: javascript ajax receive multiple values 
Javascript :: jquery deferred 
Javascript :: group attribute array 
Javascript :: Array iteration in ES6 
Javascript :: react table className 
Javascript :: array.length 
Javascript :: data-toggle="tooltip not working due to jquery-ui.min.js 
Javascript :: how to access node js server from another computer 
Javascript :: react multiple select dropdown 
Javascript :: javascript eval() function 
Javascript :: before unload 
Javascript :: The element.style Property 
Javascript :: save js 
Javascript :: mongoos populate a ref 
Javascript :: pass parameter to javascript function onclick 
Javascript :: chrome.browseraction.getbadgetext 
Javascript :: bubbling and capturing in javascript 
Javascript :: javascript getter arrow function 
Javascript :: google script get sheet size 
Javascript :: props in classes 
Javascript :: jsdoc object destructuring 
Javascript :: random message in discord.js 
Javascript :: keep value after refresh javascript 
Javascript :: update an array element with an array in mongoose 
Javascript :: map and reduce an array in js 
Javascript :: prototype chain in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =