ux icon indicating copy to clipboard operation
ux copied to clipboard

Dropzone: handle multiple files

Open jmsche opened this issue 4 years ago • 10 comments

It would be nice if Dropzone could handle multiple files.

I was expecting it would as its parent type is the FileType, that allows setting multiple option to true.

jmsche avatar Dec 04 '20 11:12 jmsche

Yep, that's a good idea! I'm not sure how to handle it properly yet but that's a good idea :)

tgalopin avatar Dec 04 '20 13:12 tgalopin

Probably like https://www.dropzonejs.com, with multiple query in ajax for upload each image and return a valid or error response.

AxelBriche avatar Dec 22 '20 21:12 AxelBriche

is Multiple Files allowed or not yet ?

Lenawel avatar May 07 '21 12:05 Lenawel

I plan to make multiple and chunked file uploads in one of my pilot project. At this moment I don't find any "official" direction about templating of UX modules (small prototypes). This is problem at my symfony collection type ux module too.

connorhu avatar May 08 '21 21:05 connorhu

Hello, I am having the same issue. I did a few things to make it work. I will try to make it available to everyone as a package

yassinehamouten avatar Nov 07 '21 16:11 yassinehamouten

Hello,

someone have the solution to do multiple upload?

expace-dev avatar Nov 13 '21 13:11 expace-dev

Hello,

You can see how I make it work there https://github.com/yassinehamouten/ux-dropzone-multiple/tree/main/Resources. I tried to do it as a package, but stimulus does not call my controller. If someone has an idea...

I changed:

  • in the form template I added "multiple" in the file input https://github.com/yassinehamouten/ux-dropzone-multiple/blob/3d282f520811ae720b0b194b7d28363eba6a1502/Resources/views/form_theme.html.twig#L6
  • and in the controller.js https://github.com/yassinehamouten/ux-dropzone-multiple/blob/main/Resources/assets/src/controller.js

You can change the symfony ux-dropzone package and build your js. It will work on production

yassinehamouten avatar Nov 13 '21 15:11 yassinehamouten

It's look like this if you take the css too image

yassinehamouten avatar Nov 13 '21 15:11 yassinehamouten

thank fou for your work, does it work if you use the DropzoneType:: class in your formType ?

JML75 avatar Dec 15 '21 08:12 JML75

@yassinehamouten this is interesting, I wasn't sure we could do it with the multiple attribute, good news! That would be a great PR if you wish :) !

tgalopin avatar Dec 15 '21 09:12 tgalopin

@yassinehamouten Would it be ok for you when I create a PR with your changes?

daFish avatar Oct 24 '22 09:10 daFish

hello

not sure what your are talking about.

best

JML

Le 24 oct. 2022 à 11:13, Marcus Stöhr @.***> a écrit :

@yassinehamouten https://github.com/yassinehamouten Would it be ok for you when I create a PR with your changes?

— Reply to this email directly, view it on GitHub https://github.com/symfony/ux/issues/7#issuecomment-1288703844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUX2AHWA2VLRZLX3XYAC6IDWEZHLPANCNFSM4UNKKZQA. You are receiving this because you commented.

JML75 avatar Oct 25 '22 15:10 JML75

i'm interesting, i try it but solution not work... what's the package to install dropzone-multiple? or just replace dropzone ux??

CodingBDX avatar Jan 25 '23 14:01 CodingBDX

I think @yassinehamouten basically forked symfony/ux-dropzone and made some tweaks to make it work with multiple - https://github.com/symfony/ux/issues/7#issuecomment-968084788 - if it's that simple, it would be great if someone made a PR here to add that support :)

weaverryan avatar Jan 25 '23 14:01 weaverryan

i try to use, this https://github.com/daFish/ux/tree/feat/dropzone-support-multiple-files/src/Dropzone/Resources

but it's not work at all...same result, just one picture @yassinehamouten i try it but it's old code for old version...

CodingBDX avatar Jan 25 '23 14:01 CodingBDX

@CodingBDX I have not yet finished the port in the linked PR. But I just rebased my branch and it is now up-to-date.

daFish avatar Jan 26 '23 10:01 daFish

@CodingBDX I have not yet finished the port in the linked PR. But I just rebased my branch and it is now up-to-date.

Does this mean multiple file upload will be available soon?

nzurita avatar Jan 31 '23 11:01 nzurita

@CodingBDX I have not yet finished the port in the linked PR. But I just rebased my branch and it is now up-to-date.

Does this mean multiple file upload will be available soon?

I could certainly need some help with finishing it.

daFish avatar Jan 31 '23 15:01 daFish

Is there an update on this topic? It seems not to work out of the box with the current version (2.7.1).

igi-1w3r53n avatar Mar 06 '23 18:03 igi-1w3r53n

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?

kristjan-kure avatar Apr 09 '23 08:04 kristjan-kure

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?

Welcome to open source. What's your budget to speed things up? I'm sure @daFish and others would find time to work on work-related things more readily than passion hobbies :-)

janklan avatar Apr 09 '23 08:04 janklan

I had a lot of trouble with this solution. I switched to uppy (https://uppy.io/) and it works good with symfony.

igi-1w3r53n avatar Apr 09 '23 09:04 igi-1w3r53n

@janklan 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 - which is already mentioned by @igi-1w3r53n.

daFish avatar Apr 11 '23 15:04 daFish

@janklan After some thoughts I'm not going to finish this.

Fair enough mate, I've been using Dropzone.js directly myself ever since I found this limitation - pretty much the same day I found this component.

For everyone else: all you need to receive multiple files is making sure your JS dropzone component (whichever it is) uploads files individually behind the scene, and then something along this trivial piece:


if (0 === $request->files->count()) {
    throw new BadRequestException('At least one file is required.');
}

if ($request->files->count() > 1) {
    throw new BadRequestException('Uploading multiple files at once is not supported.');
}

$uploadedFile = $request->files->get('file');

I'm honestly not convinced there is a need for an UX component and a dedicated form field for this. What does it actually simplify?

janklan avatar Apr 11 '23 21:04 janklan

Is there an update on this topic? I need an option to allow multiple file-uploads using this dropzone-component...

cmartin6 avatar Jun 13 '23 07:06 cmartin6

I don't understand the priorities. They should be:

  • Common UI components - the essence of multiple image upload is to save data. This should have been built once Symfony UX was developed.
  • Multiple select - we had to use https://tom-select.js.org/
  • Modal - I don't see it on https://ux.symfony.com/.
  • WYSIWYG editor - I don't see it on https://ux.symfony.com/.
  • Gallery
  • Date picker - I don't see it on https://ux.symfony.com/.

etc.

kristjan-kure avatar Jun 13 '23 19:06 kristjan-kure

I don't understand the priorities. They should be:

I find myself saying this more often than I like: welcome to open source. Feel free to contribute a solution to a real-world problem you're experiencing.

It's not easy, which is the reason why there are more takers than givers. If it helps you do your job and make a living, don't give advice how things should be, and give your time and skills instead :)

janklan avatar Jun 13 '23 22:06 janklan

I don't understand the priorities. They should be:

I find myself saying this more often than I like: welcome to open source. Feel free to contribute a solution to a real-world problem you're experiencing.

It's not easy, which is the reason why there are more takers than givers. If it helps you do your job and make a living, don't give advice how things should be, and give your time and skills instead :)

Sorry, I am not a back-end developer, so I can't help build it, and I am not here to criticize. However, I can suggest a direction and discuss the need from my personal perspective.

With my experience of 20 years in web development, I believe the UX project requires a significant change in direction. One possible approach is to engage the community by allowing them to vote for UI elements. Those who have the time and expertise can contribute to building it. Votes will define the priorities. I do understand that you will need to figure out the message to send and motivate voters.

Here's an example: https://community.talk.hyvor.com/. This platform utilizes https://www.featurebase.app/ for feature voting.

kristjan-kure avatar Jun 14 '23 07:06 kristjan-kure

The end goal here is to establish Symfony as a prominent PHP web application framework in the market?

kristjan-kure avatar Jun 14 '23 07:06 kristjan-kure

@daFish had done most of the work. The problem is only on the preview because ux-dropzone manage already multiple files

ytilotti avatar Oct 23 '23 13:10 ytilotti