jeudi 9 février 2017

how to send pdf file as base64data url in angular 2?

Vote count: 0

i am using angular 2.i wish to convert pdf file to base64dataurl. i tried following

<input type="file" (change)="fileChange($event)" placeholder="Upload file" accept=".pdf,.doc,.docx">-->
      <!--<p>Select a File to Load:</p>
    <input id="inputFileToLoad" type="file" onchange="loadImageFileAsURL()" />

my ts file is

fileChange(event) {
   var reader = new FileReader();
    reader.readAsBinaryString(event)
   reader.onload = function () {
     console.log(reader.result);
   };
   reader.onerror = function (error) {
     console.log('Error: ', error);
   };
}

i tried the following js fiddle [http://ift.tt/2k9yUcS]

give the answers in angular 2 only

asked 17 secs ago

Let's block ads! (Why?)



how to send pdf file as base64data url in angular 2?

Aucun commentaire:

Enregistrer un commentaire