Question Sabit Issakhan · Oct 29, 2018

Hello Everyone!

Following the example below i can download file only txt format, in other format(pdf,xls,rar) i have errors(can't open file), 

So, how i will change code for download file in other format? 

Thanks! 

ClassMethod GetFile(file) As %String
{
#dim %request As %CSP.Request
    set filename="E:\Rest\"_file   
    set %response.ContentType=..GetFileContentType($p(filename,".",*))
    do %response.SetHeader("Content-Disposition","attachment;filename="""_$p(filename,"\",*)_"""")
    Set %response.NoCharSetConvert=1
    Set %response.Expires=50
    set file=##class(%File).%New(filename)
    do file

3
1 1490