Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何以精确的扩展名下载文件_Php_Angular_Ionic Framework - Fatal编程技术网

Php 如何以精确的扩展名下载文件

Php 如何以精确的扩展名下载文件,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>

我想用硬线通过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>

  {{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');

  }