1

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>
blackhard
  • 353
  • 5
  • 21
  • Can you please check this out: – Abu Sufian May 27 '19 at 10:07
  • @AbuSufian Unfortunately it doesn't work. – blackhard May 27 '19 at 10:17
  • what is your file extension '.info.system.yaml' or just '.yaml' ? – Abu Sufian May 27 '19 at 10:20
  • @AbuSufian I'd like to accept the files with endings '.info.system.yaml'. For example, 'test1.info.system.yaml' or 'myData.info.system.yaml'. I took a look at validation code in plugin [here](https://github.com/danialfarid/ng-file-upload/blob/master/src/validate.js) in function globStringToRegex and it should work, but I don't understand why it doesn't :( – blackhard May 27 '19 at 10:27

1 Answers1

0

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?.