Getting pdf data from input and uploading firebase

I’m new to ionic+angular. I have the following code below for uploading pdf’s to firebase but it does not work. Is that the right way of getting the data from pdf? The code was copied from someone online for uploading images and I tried to modify it for pdfs.

 <input type="file" id="getFile" accept="application/pdf" [(ngModel)]="this.ChoosenPDF">

  upload() {
    if (this.ChoosenPDF) {
      const uploadTask = firebase.storage().ref().child('pdf/mypdf.pdf')
        .put(this.ChoosenPDF);
      uploadTask.then(this.onSuccess, this.onError);
    }
  }

  onSuccess = snapshot => {
    this.ChoosenPDF = snapshot.downloadURL;
    console.log("success");
  };
  
  onError = error => {
    console.log("error", error);
  };