dropzone icon indicating copy to clipboard operation
dropzone copied to clipboard

Input multiple + capture=camera

Open kuindji opened this issue 12 years ago • 8 comments

_this.hiddenFileInput.setAttribute("multiple", "multiple");

When using in mobile browsers "multiple" attribute prevents from capturing from camera. (capture="camera" attribute). It would be nice to have an option for this!

kuindji avatar Apr 16 '14 11:04 kuindji

Same problem here. On Android we can still select between Camera or Document, but on iOS we can only navigate trough the gallery. What can we do to be able to call the Camera on iOS? Is there a workaround?

joyalexandre avatar Oct 15 '14 21:10 joyalexandre

I see in the source code you can now set options.maxFiles = 1. Combined with options.capture = "camera" it should work correctly. "multiple" attribute will not be set and you'll be able to use the camera.

kuindji avatar Oct 16 '14 05:10 kuindji

I've managed to get the option to take a picture even on iOS7/8 devices with the maxFiles=1. Thanks.

The capture option seems to do nothing more. The problem now is that we can't upload another file after since the total file is blocked to one. I mean, we could avoid the multiple selection for a single request without problem and click a second time to upload another one. No? Is it me that missed something or is the library that doesn't support it yet?

By the way, this is a wonderful lib!

joyalexandre avatar Oct 16 '14 15:10 joyalexandre

Also, the uploadMultiple seems to do nothing more. Shouldn't it be the trigger for the multiple attribute? and maxFiles the maximum number of files supported for the dropzone?

joyalexandre avatar Oct 16 '14 15:10 joyalexandre

The uploadMultiple does not seem to control normal hidden input, but it controls file input in fallback form and upload queue. That is rather confusing.

I'd try to change the line 529 in the source code from

@hiddenFileInput.setAttribute "multiple", "multiple" if [email protected]? || @options.maxFiles > 1

to

@hiddenFileInput.setAttribute "multiple", "multiple" if @options.uploadMultiple? && @options.capture != "camera"

But I am not sure if it will solve all problems.

kuindji avatar Oct 16 '14 15:10 kuindji

As I see in my code, I've resorted to the following:

if (Modernizr.touch) {
    dz.hiddenFileInput.removeAttribute("multiple");
    dz.hiddenFileInput.setAttribute("capture", "camera");
}

kuindji avatar Oct 16 '14 15:10 kuindji

If I understand what you mean, by putting capture: "camera" and uploadMultiple: false. I will not need the maxFiles: 1 to get the "Take a picture" option on an iOS device. Tell me when I will be able to download the new JS and test it. I will test it for you on iOS7 and 8.

Thanks for your precious help :-)

joyalexandre avatar Oct 16 '14 16:10 joyalexandre

Sorry mate, can't tell you that - I have no relation to this project :D

Poke @enyo :D

kuindji avatar Oct 16 '14 16:10 kuindji