I am using ionic to build a mobile app that incorporates a file upload.
Versions
- ionic (Ionic CLI) : 4.10.3
- Ionic Framework : ionic-angular 3.9.3
- @ionic/app-scripts : 3.2.3
The files supported are
- images
- word documents (.doc, .docx)
I am trying to use a HTML input tag with the attribute of type="file"
<input style="display:none;" type="file" accept="image/*, .pdf, .doc, .docx" (change)="fileSelected($event)" #chosenFile />
<button class="btnAttach" (click)="chosenFile.click()"><ion-icon class="attach" name="attach"></ion-icon></button>
This is working perfectly for images on android and ios but it does not allow me to select pdf or word documents. I can see them but they are greyed out.
Any help here would be appreciated.

accept="image/*, .pdf, .doc, .docx"withaccept="image/*, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document". From the docs: If the value of the type attribute is "file", then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers. . You need to provide the mime type, not the extension stackoverflow.com/questions/17293861/…<input type="file"