danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.59k forks source link

Using file extensions in pattern does not work for Drag and drop #2011

Open ObsoleteAcey opened 7 years ago

ObsoleteAcey commented 7 years ago

When using a file extension for the pattern, dragging a file with the correct extension always shows the error class. The reason seems to be that (at least in Chrome), the file passed in to upload.validatePattern doesn't actually contain a file name. When using the type (such as application/pdf), this works fine.

ObsoleteAcey commented 7 years ago

And the issue... it seems dragenter doesn't have access to the actual file being dragged.

https://stackoverflow.com/questions/41450438/datatransferitems-getasfile-method-returning-null-for-files