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

How to get a list of files after all are added and a user is satisfied with them? #41

Open
randomnonsense opened this issue Sep 26, 2018 · 2 comments

Comments

@randomnonsense
Copy link

randomnonsense commented Sep 26, 2018

This is a bit of an abstract concept. I'd need to get a list of all files which are successfully uploaded, but not dynamically, i.e. not right after they are completed i.e. not using fileSuccess event.

Context:

  1. A user uploads a few files. Then deletes some. Then uploads some more, etc.
  2. When they are satisfied with the result, the files can be now processed further, in PHP.
  3. The user clicks on a "ready" button and PHP automagically receives a list of files registered with ng-flow,

i.e. those visible in the 'completed' table, e.g. one featured in https://github.com/flowjs/ng-flow/blob/master/samples/basic/index.html and listed by <tr ng-repeat="file in $flow.files">

I am versed with PHP, and only green with Javascript. Any help and possibly a sample code (what to add to app.js) would be very welcome. Many thanks.

@randomnonsense
Copy link
Author

randomnonsense commented Sep 26, 2018

The main problem here is that any files which could be recorded with PHP, are the files which were successfully uploaded to the server. If a user clicks "cancel" in flow.js/ng-flow (for example using an UI similar to https://github.com/flowjs/ng-flow/blob/master/samples/basic/index.html) and clears their list of uploaded files, or cancels a particular file, PHP doesn't know which files are "good to go" and which are not, as it only assembles chunks into complete files.

What would be needed here is some kind of mechanism to basically let PHP know which of the successfully uploaded files to keep and which can be discarded. Best by a button click I think, as explained above.

@randomnonsense
Copy link
Author

Okay, the very first and amateurishly crude solution would be to add a form using ng-repeat="file in $flow.files" and then a hidden input for each {{file.uniqueIdentifier}} and submit that as an extra request independent of flow's mechanics. Does the job.

Is there a better way, using flow.js/ng-flow's internals?

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

No branches or pull requests

1 participant