Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<HTML> download .sql file

I'm working on a Angular App

I've this function

`

vm.DownloadFile = function (item) {


                var a = document.createElement('A');
                a.href = item.fileSourceUrl;

                a.download = item.fileSourceUrl.substr(item.fileSourceUrl.lastIndexOf('/') + 1);
                document.body.appendChild(a);

                a.click();
                document.body.removeChild(a);


    }

`

This allows me to download files from my view using an url . It works fine, i can download my files with that.

The problem I just noticed is that i can't download .sql files . Why ? Many types of file are working , .jpg , .pdf , .dwf ... everything but .sql

like image 713
Sonny Jayet Avatar asked Jul 07 '17 09:07

Sonny Jayet


2 Answers

I finally found what was wrong , MIME type for .sql was not set in my IIS configuration.

like image 190
Sonny Jayet Avatar answered Oct 06 '22 01:10

Sonny Jayet


You need to set MIME type for .sql files

To set MIME type

  • Open IIS Manager
  • In Features View, double-click MIME Types.
  • In the Actions pane, click Add.
  • In the Add MIME Type dialog box, type a file name extension in the File name extension text box.
  • Type a MIME type in the MIME type text box.
  • Click OK.
  • like image 22
    jithin john Avatar answered Oct 06 '22 00:10

    jithin john