PDF file upload without using input type "file" from browse

#1

I am trying to upload a local file which I have the URL. I can upload the file from the browse button. The event.target.files from html gets me the file in a FileList and I can upload this in a new FormData() I append the file and POST the request this is working.

I want to change the implementation to picking the URL and appending the in the FormData().

I tried reading the file in array or asURL but this is not working.

I do not want to use FileTransfer cause I have some signature problem while signing for the post call. Any help?

#2

This is what is looks like for file URL
file:///storage/emulated/0/PrintMeTemp/%3A%3A%20Vista%20%3A%3A.pdf

#3

private readFile(file: any) {
const reader = new FileReader();
reader.onloadend = () => {
const formData = new FormData();
const imgBlob = new Blob([reader.result], {type: file.type});
formData.append(‘file’, imgBlob, file.name);
// logic to upload file
},
error => { }
);
};
reader.readAsArrayBuffer(file);
}