Thank you for this great plugin. I'm aware that by providing a {server: { revert:(...) => { object to setOptions will allow you to define custom operations processing uploaded files. But lets say I want to add some extra buttons to the uploader for several tasks, besides obviously creating my own onClick handlers, how can I, given a upload id already, inform filepond to revert an upload?
I know there's a cancel button built in but my needs are more specific.
I'm using filepond with Vue as a single page component.
The revert handler is triggered by the removeFile call, so maybe you can use that?
Is there anyway to call removeFile from vue-filepond? I'm using filepond with vuejs
If you follow the example on the github repo the method can be called like this this.$refs.pond.removeFile()
The
reverthandler is triggered by theremoveFilecall, so maybe you can use that?
i dont think this is true, did you try?
@rikschennink the revert handler (DELETE request at server) is not triggered. The files are removed only in the Filepond instance.
We also need to programatically revert files already uploaded to server (in our case, we need a "clear uploads" button, and filepond.removeFiles() should trigger DELETE requests for all uploaded files)
@sbusch You're right, it doesn't call the revert, see test case: https://codesandbox.io/s/vanilla-filepond-revert-remove-o2yqo?file=/src/index.js
Will see if I can pick this up later this week.
@sbusch should be fixed in 4.13.5, please confirm.
https://github.com/pqina/filepond/releases/tag/4.13.5
@rikschennink first thank you for your effort! I now had the time to test it the new release. Unfortunatley it doesn't work for me.
When I call filepond.removeFile(), the first uploaded file is removed from view but no DELETE request (as defined by server.revert) is submitted.
The reason is - at least - that the file's origin is 1 (== FileOrigin.INPUT), so your change at https://github.com/pqina/filepond/blob/044a7ca00393b6f03cf732ae61a2ce6a876ad8a1/src/js/app/actions.js#L906 does not apply. I wrote "at least" because I'm not sure if item.revert(createRevertFunction(... would issue such a DELETE operation at all...
@sbusch just published 4.13.6 which should fix this issue
Works for me, removeFile() and removeFiles() trigger the DELETE request :-)
Thank you very much!
@sbusch this functionality has been reset in 4.13.7 as it caused backwards incompatibility issues, you can still trigger revert by adding { revert: true } as a parameter to removeFile() or removeFiles()
@rikschennink Thanks for the heads-up, didn't expect that kind of service! I'll update & test it
@rikschennink better late than never:
removeFile() works as expected:
removeFile({revert: false}) removes first element and doesn't revert (= no DELETE XHR)removeFile({revert: true}) removes first element and reverts the upload with a DELETE XHRBut I cannot get removeFiles() working. Behavior is the same for removeFiles({revert: false}) and removeFiles({revert: true}), always:
DELETE XHR is issued for the first file (independent of revert option)Am I holding it wrong? ;-)
Update: I'm using current version of Filepond (4.18.0)
@sbusch should be fixed in release 4.19