Skip to content
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

accept attribute ignored in Firefox #486

Closed
bolemeus opened this issue Jan 7, 2015 · 4 comments
Closed

accept attribute ignored in Firefox #486

bolemeus opened this issue Jan 7, 2015 · 4 comments

Comments

@bolemeus
Copy link

bolemeus commented Jan 7, 2015

The accept attribute seems to be ignored in firefox. I've tested it in Chrome and it works fine when I set it to application/pdf. I cannot select any files other than pdf files, and when I try to drop another file over the drop zone the correct class is being applied to it.

In firefox (33.1.1) however it is possible to select files other than pdf files, and they are appended to the files[] array. When dragging a file other than a pdf files over the drop zone the incorrect class is being applied, but when I drop a file other than a pdf file it is not being added.

This behaviour is also present in the demo. I can select files other than images or pdf files in the demo...

https://angular-file-upload.appspot.com/

dragging another file over the dropzone also causes the incorrect class to be applied to the dropzone in the demo.

I'm already using a file-change listener, so I'll try to fix it there.

@bolemeus
Copy link
Author

bolemeus commented Jan 7, 2015

Ok,

I've partially fixxed this. I'm using the file-change listener to check the file type is equal to application/pdf. If it is not, then I won't add it to the array of files.

I've discovered another strange behaviour though. It seems that the listener is not always called when a file is selected. When selecting a file twice in a row. the listener is not called the second time.

@danialfarid
Copy link
Owner

Seems like a firefox issue: https://bugzilla.mozilla.org/show_bug.cgi?id=826185
But selecting the same file twice works fine for me and the model will change twice as in the demo page.
Firefox 33.1.1

@bolemeus
Copy link
Author

bolemeus commented Jan 7, 2015

Too bad Firefox is the problem here. :(

When selecting thesame file multiple times though, it surely works, but it seems the listener function is only called the first time.

ng-file-change="fileSelected($files, $event)"

The function fileSelected() is only called the first time.

It's not a big deal for me at the moment, because I can work around it. It does prevent me from implementing something which is a nice to have though. Showing a toast when the user tries to upload thesame file twice is not possible...

@danialfarid
Copy link
Owner

This should be fixed in 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants