Ionic File Upload using HTML5 input

╄→尐↘猪︶ㄣ 提交于 2020-02-04 22:17:12

问题


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)
  • pdf

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.

来源:https://stackoverflow.com/questions/55416283/ionic-file-upload-using-html5-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!