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

Support maxFileSize, maxFiles, and maxUploadSize #27

Closed
garjitech opened this issue Oct 7, 2012 · 2 comments
Closed

Support maxFileSize, maxFiles, and maxUploadSize #27

garjitech opened this issue Oct 7, 2012 · 2 comments

Comments

@garjitech
Copy link
Contributor

I want to add support for maxFileSize, maxFiles, and maxUploadSize. Each time a file is added, it is first validated against these limits (if they are passed in as options) and marked as valid or invalid. Invalid files would not be uploaded but would still fire an event to let the user know they were added to the queue.

I was thinking a revalidate method could be added to Resumable and calling it would loop through the invalid files and update their validation status. Any files that are updated from invalid to valid would automatically be included for upload (e.g. if a valid file is removed, we may want to revalidate so that an invalid file which exceeded the maxFiles limit would now be valid and included in the upload).

I've toyed around with several possible implementation and wanted to see what your thoughts were before submitting a pull request.

@garjitech
Copy link
Contributor Author

I was also considering adding an option which would allow the user to specify an external validation function (e.g. for possible server side validation).

Your thoughts?

@steffentchr
Copy link
Member

My quick thoughts on maxFiles are on #17 and #25 -- and #25 was just merged in.

I think maxFiles can be handled as a special case, because we might want to clear the multiple option in the file input when the value is set to 1. For any other kind of validation/verification (whether total upload sizes, file type, names, or even reading of the files) I like your idea of having a callback. I would implement it by sending an array of file objects to the function -- which in turn would manipulate that data and return an array of the files to be included in the request. So basically and filter.

Would that work for your case?

This issue was closed.
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

2 participants