Ionic file and file chooser

I want to upload/select a file from the mobile So I’m using ionic file & filechooser plugins. This is my code.

fileData: any;
uploadFile() { => {

       this.file.resolveLocalFilesystemUrl(uri).then((newURL) => {

         let dirPath = newURL.nativeURL;
         let dirPathSegments = dirPath.split('/');   // break string into array
         dirPathSegments.pop() // removes the file name
         dirPath = dirPathSegments.join('/')
         this.file.readAsArrayBuffer(dirPath, (buffer) => {
          await this.upload(buffer,

  async upload(buffer, name) {
    this.fileData = new this.fileData([buffer],{ type:"pdf" });

I want to store the buffer & name in variable. I have stored it the variable fileData. Is it is correct approach for storing a file in a variable called fileData.If it is wrong can someone help me in the coding?