I have FilePond (via React) configured to upload multiple files, to receive those files on the back-end, store them, and show them properly when revisiting the page.
let server = {
url: '/mypath',
process: '/mypath',
revert: '/mypath'
};
<FilePond
server={server}
allowMultiple={true}
allowRevert={true}
files={current_files}
/>
Using a Python back-end, this works fine for uploads:
if request.method == "POST":
# handle request.FILES.get("filepond")
Now I want to implement DELETE, so I add allowRemove={true}
to the FilePond instance and a revert: /path
to the server
configuration. What I expect to happen is that when user clicks the X, FilePond sends a DELETE request. But nothing happens - user clicking X does not send any request at all to the registered endpoint. I did find that I can add:
onremovefile={(file) => handleRemove(file)}
and if I make a handleRemove()
React function, it is called with the file
object. But this seems hacky - shouldn't clicking X automatically contact the registered the endpoint?
Should I proceed to send a DELETE manually from my handleRemove()
function, or am I missing something in my configuration? The docs imply that a "revert" actions triggers DELETE when revert
is defined on the server object.