leon / angular-upload

Upload service with iframe fallback and some nice directives to go with it.
MIT License
234 stars 100 forks source link

Nothing happends when you click button. #24

Closed AMetnik closed 10 years ago

AMetnik commented 10 years ago

I'd like that when the whole upload button is clicked, then it will show the filechooser dialog. Right now as it is, it only happens if the input field is clicked, maybe others would as well

element.on('click', function() { var children = this.childNodes; if (children.length > 0) { for (var i = 0; i < children.length; i++) if (children[i].type==="file") { children[i].click(); } } });

directive link, under el.append(fileInput)

leon commented 10 years ago

It's a security feature (implemented in all browsers), you cannot open a file picker by invoking it via javascript.

AMetnik commented 10 years ago

Okay, I've seen it other places, but I don't really understand why it is a "security feature" ? :) (If you have time, I'd like a referal to some doc so I can understand)

leon commented 10 years ago

Maybe you're not including the correct css? https://github.com/leon/angular-upload/blob/master/src/directives/btnUpload.min.css If you want to use the upload button to look like a button but behave like a fileinput, the css will make the input invisible and place it over the button. So when you click the button it's actually the input being clicked.

AMetnik commented 10 years ago

Right you are. Sorry, and thanks a lot for the help.

On Mon, Sep 8, 2014 at 1:41 PM, Leon Radley notifications@github.com wrote:

Maybe you're not including the correct css?

https://github.com/leon/angular-upload/blob/master/src/directives/btnUpload.min.css If you want to use the upload button to look like a button but behave like a fileinput, the css will make the input invisible and place it over the button. So when you click the button it's actually the input being clicked.

— Reply to this email directly or view it on GitHub https://github.com/leon/angular-upload/issues/24#issuecomment-54806433.

Med venlig hilsen / Best regards

Anders Metnik

+45 61712125 Frederikssundsvej 418, 1. TV. 2700 Brønshøj