Php 如何以精确的扩展名下载文件
我想用硬线通过HTML标签从服务器下载一个文件 status.htmlPhp 如何以精确的扩展名下载文件,php,angular,ionic-framework,Php,Angular,Ionic Framework,我想用硬线通过HTML标签从服务器下载一个文件 status.html <ion-col size="2" style="border-right:none;" > <ng-container *ngFor="let doc of document; "> <a href="http://myinnovativetest.com/CR/uploads/{{doc}}" (click)="download(doc)" download>
<ion-col size="2" style="border-right:none;" >
<ng-container *ngFor="let doc of document; ">
<a href="http://myinnovativetest.com/CR/uploads/{{doc}}"
(click)="download(doc)" download>
{{doc}}
</a><br />
</ng-container>
我希望下载文件download.jpg,但它下载为download.html,您可以使用
从“文件保护程序”导入{saveAs}代码>
download(doc) {
this.fileService.downloadFile().subscribe(response => {
FileSaver.saveAs(response, "data.pdf");
}), error => console.log('Error downloading the file'),
() => console.info('File downloaded successfully');
}
download(doc){
this.fileService.downloadFile().subscribe(response => {
window.location.href = response.url;
console.log(response.url)
}), error => console.log('Error downloading the file'),
() => console.info('File downloaded successfully');
//console.log("hello")
}
download(doc) {
this.fileService.downloadFile().subscribe(response => {
FileSaver.saveAs(response, "data.pdf");
}), error => console.log('Error downloading the file'),
() => console.info('File downloaded successfully');
}