Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change the default remove behaviour #47

Closed
aitorllj93 opened this issue May 24, 2018 · 5 comments
Closed

Unable to change the default remove behaviour #47

aitorllj93 opened this issue May 24, 2018 · 5 comments

Comments

@aitorllj93
Copy link

aitorllj93 commented May 24, 2018

Hi,

I have troubles handing de DELETE file method

The revert handler works well when upload is done with the component, but when I load
the files preloaded with this format:

{
  source: file,
  options: {
    type: 'local'
  }
}

I'm unable to change the remove file default behaviour

Thanks for your time

@rikschennink
Copy link
Collaborator

I’ll test it this afternoon, it’s set up to remove temporary files, so maybe I missed a use-case 🙃

@rikschennink
Copy link
Collaborator

@aitorllj93 There's currently no remove end-point. It only handles reverting temporary files.

The reasoning behind this is that destructive actions like that should be done after careful consideration ( and would require an undo option or serious confirm popup ). FilePond keeps a list of current files, then, when the parent form is submitted you can determine the differences after the user made changes to the files list and remove the necessary files from the server.

I'm considering adding this as an option but am wondering if the solution above would work for your use-case?

@aitorllj93
Copy link
Author

Hi @rikschennink, sorry, was my fault, I had already handled the remove event but didn't saw it.

The problem now is, this event gets called also during revert process so I'm unable to know if that file was already deleted by the revert handler

@rikschennink
Copy link
Collaborator

@aitorllj93 Yes that's also a way handle it. I think a property to indicate the origins of the file would be a nice addition, something like: local, limbo, input. That should offer enough detail to be able to handle file removal in the remove handler.

@rikschennink
Copy link
Collaborator

@aitorllj93 Just added the origin property to the file item and the FileOrigin enum to the FilePond object. The origin is either 1, 2 or 3, and you can use the FileOrigin enum to make your code more readable.

It's available in version 1.6.1

export const FileOrigin = {
    INPUT:1,
    LIMBO:2,
    LOCAL:3
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants