I have a input type file, where I have allowed only pdf files, on submission of the form I want to send the pdf file to an endpoint url via POST but it requires to be in base64. There are other parameters I will be sending in the JSON.
I have added a change event in the input type file, but cant figure out how to convert the pdf file to base64 and add it to the JSON.
<div class="add-mag-pdf-btn">
<label for="pdf">
<input type="file" (change)="uploadPDF($event)" id="pdf" accept=".pdf" />
<p>add PDF</p>
</label>
</div>
uploadPDF(event: any) {
console.log(event)
}