-
Notifications
You must be signed in to change notification settings - Fork 37
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
Multiple browse/drop targets with different callbacks? #71
Comments
Hi, sure this should be possible with a little customization. The built-in resumable.js instance support is really just a convenience for the most common case. In your case, I think that you can just setup however many additional resumable.js instances a given page needs, being careful to configure each of them to be compatible with the server-side resumable endpoint: https://github.com/vsivsi/meteor-file-collection/blob/master/src/resumable_client.coffee#L28-L41 |
Thanks; this worked. This is probably obvious to you, but I had to set I'm also wondering whether I could capture the drop target / browse button events myself, mark the files with attributes about where they came from, and send them to a global resumable. I might try that next. |
This also worked well, and is perhaps simpler -- it enables global upload limits etc. Some sample CoffeeScript code:
Speaking of the last few lines (based on your sample code), could you explain why it's OK to call |
Hi, I've also never seen a problem with that call to |
edemaine, I am in a similar situation as you. Let me see if I understand your 2nd solution... You intercept the attachInput message, and pass a messageId in the parent message of each file and do your own addFile call. I assume you also do the same for drop? Then in file added you pull the parentMessage and use that to determine your next steps? |
@dpatte: Yes, that's exactly what I'm doing. And I do the same for drop. Here's some updated CoffeeScript code, which enables dragging onto an upload button, or clicking the upload button which triggers the browse of the file form input. Id and group fields of the template go into file metadata.
Jade template looks like this: (Let me know if you need HTML.)
|
In my application, there are multiple posts, and each post (rendered by its own template) should have its own browse button/drop target to attach files to the post.
Is this possible with file-collection? The package looks really great, except possibly for this issue, possibly caused by a limitation of Resumable.js.
assignBrowse
andassignDrop
accept multiple targets, which is annoying because each post is its own template, but workable -- but thenon('fileAdded')
doesn't seem to include in the event which one it came from. Perhaps the "right" answer would be to have multiple Resumable instances -- is this possible with (or easy to add to) file-collection?The text was updated successfully, but these errors were encountered: