Is it possible to add complex extension in ng-file-upload plugin to accept specific files?

188 Views Asked by At

I'm using ng-file-upload plugin to upload files and I'd like to select files with specific extension. In my case it's .info.system.yaml extension. I've looked through examples and see only short variants like .pdf, .docs and etc.

Based on the documentation I've tried ngf-pattern="'.info.system.yaml'" and ngf-accept=".info.system.yaml" but it doesn't work.

<button class="btn btn-default"
     ngf-select="selectFiles($files, $invalidFiles)"
     ngf-pattern="'.info.system.yaml'"
     ngf-accept=".info.system.yaml"
     multiple>Select File</button>
1

There are 1 best solutions below

0
Joseph Cain On

The ng-file-upload module uses the FileApi which will accept all MIME types or also known as a Multipurpose Internet Mail Extensions or MIME type https://www.iana.org/assignments/media-types/media-types.xhtml. Unfortunately, yaml is not on the list at all/has not been accepted yet reference stackoverflow answer here YAML mime type?.