How to get the name of a file downloaded with Angular $http?

前端 未结 10 894
一生所求
一生所求 2021-02-01 15:36

I\'ve written code that uses Angular $http to download a file. The name of the file is not specified in the URL. The URL contains a unique identifier for the file, wh

10条回答
  •  萌比男神i
    2021-02-01 16:26

    Maybe you already find solution, but I will post this answer if someone else has this problem.

    Add these parameters in the success callback function from the $http request:

        $http.get(myUrl).success(function (data, status, headers, config) {
            // extract filename from headers('Content-Disposition')
        });
    

提交回复
热议问题