I'm trying to implement a download routine in an application. It worked normally, but when I went to see it I had only done tests with PDF. Already in images (jpg, png, ...) it does not work.
When I edited the file in notepad++
the first 2 lines contain this content:
--94a7e522-5247-467b-9550-9c381203c2d7
Content-Disposition: form-data; name="NomeImagem.jpg"; filename="NomeImagem.jpg"
In the PDF it contains the same lines but it opens normally.
Here is my implementation of file-transfer :
downloadFile(idFile: number, nameFile: string): Promise<any> {
return new Promisse<any>((resolve, reject) => {
const fileTransfer: FileTransferObject = this.fileTransfer.create();
fileTransfer.download('${Config.getWs()}api/DownloadFile?id=${idFile}', '${this.file.getExternalDataDirectory}${nameFile}', {headers: {"token": Config.getToken()}})
.then(res => resolve(res));
.catch(error => reject(error));
});
}
Does anyone know what it can be? Thank you.