-
-
Notifications
You must be signed in to change notification settings - Fork 357
[Dropzone] Enable multiple file uploads #512
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
Conversation
e8a8a1e
to
7105e52
Compare
7105e52
to
05ffafc
Compare
@tgalopin & @weaverryan Would you mind to review this PR? 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I have some questions - either we're not (yet) quite supporting the "preview" for multiple files, or I'm missing it!
Cheers :)
@@ -2,6 +2,7 @@ | |||
{%- set dataController = (attr['data-controller']|default('') ~ ' symfony--ux-dropzone--dropzone')|trim -%} | |||
{%- set attr = attr|merge({ 'data-controller': '', class: (attr.class|default('') ~ ' dropzone-input')|trim}) -%} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, but we can revert this change
} | ||
|
||
this._dispatchEvent('dropzone:change', file); | ||
this._dispatchEvent('dropzone:change', event.target.files); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not this in the CHANGELOG - that's a minor BC break.
@@ -42,31 +42,34 @@ export default class extends Controller { | |||
this.previewImageTarget.style.display = 'none'; | |||
this.previewImageTarget.style.backgroundImage = 'none'; | |||
this.previewFilenameTarget.textContent = ''; | |||
document.querySelectorAll('.dropzone-preview-image-container').forEach((e) => e.remove()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm missing it, where/what is creating this .dropzone-preview-image-container
element?
|
||
// Show the filename in preview | ||
this.previewFilenameTarget.textContent = file.name; | ||
this.previewTarget.style.display = 'flex'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tried the code yet, but how does this work with multiple files? It looks like if I attach multiple files, only the last one's filename would show up (it would override the earlier ones). Or very possibly I am missing a detail :)
After a small conversation with @weaverryan on Slack I plan to add the following options to this component:
|
806cc8a
to
3e47174
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
I played with this locally, but it doesn't look like multiple previews show up - just the one. Is that my mistake? Or do we still need a good deal more work - like to have potentially multiple "preview" areas instead of just one?
Thanks!
numberOfFiles: Number | ||
} | ||
|
||
readonly numberOfFilesValue: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already removed.
@@ -2,6 +2,7 @@ | |||
{%- set dataController = (attr['data-controller']|default('') ~ ' symfony--ux-dropzone--dropzone')|trim -%} | |||
{%- set attr = attr|merge({ 'data-controller': '', class: (attr.class|default('') ~ ' dropzone-input')|trim}) -%} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -28,6 +28,7 @@ public function configureOptions(OptionsResolver $resolver) | |||
'attr' => [ | |||
'placeholder' => 'Drag and drop or browse', | |||
], | |||
'multiple' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that needed? It's already the default of the parent type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has been removed.
Hi! We need multiple file upload. Who can help with this? I understand daFish has been developing it, but we need it live? Who on the Symfony development team can help us to work with this? |
After some thoughts I'm not going to finish this. It is based upon the work of @yassinehamouten and I'd rather propose to go with uppy.io. |
sorry to pick up on the old PR. But the above mentioned missing preview on more than one file seems still not to be working. I tried the current version of UX Dropzone, the multiple in the form element works. It accepts multiple files and posts them along with the form. But the preview of more than one file and the capability of adding more files seems also be missing. Is there any trick i am missing? |
This change adds the posibility to upload multiple files using the Dropzone component. This is based on the work by @yassinehamouten.