Select a PDF file from input type file in IOS


#1

Hi all,

I’m trying to select a PDF file from the device and upload the file to S3.
to select the file i’m using the input tag with type as file.
my requirement is, i have an action sheet and on clicking on an option from the action sheet, i need to open the file choose window from the code. for this i’m using the following code

<input type="file" accept="application/pdf" (change)="showPDF($event);" [style.display]="'none'" #fileInput>

@ViewChild('fileInput') public fileInput: ElementRef;

 private uploadPDF() {  
    this.fileInput.nativeElement.click();
  }

The following code works in Android but doesn’t work in IOS (in IOs, in some devices it works, but not all the time the popup to browse of choose from icloud shows up)

i’m clearing the input before calling the click handler
this.fileInput.nativeElement.value = null;

is there any other way to do this