Hi Jeffrey - that's perfect, thanks for taking the time to reply. Once last question: do you know how I might locate information on the Arbiter connection status?


Andy

I solved it.

I changed to OnPage() method to use a %Stream.FileCharacter as follows:

ClassMethod OnPage() As %Status
{
	
	set fs = ##class(%Stream.FileCharacter).%New()
	set fs.Filename = %request.Get("filepath")
	
	do fs.OutputToDevice()
	quit $$$OK
}

I solved it.

I changed to OnPage() method to use a %Stream.FileCharacter as follows:

ClassMethod OnPage() As %Status
{
	
	set fs = ##class(%Stream.FileCharacter).%New()
	set fs.Filename = %request.Get("filepath")
	
	do fs.OutputToDevice()
	quit $$$OK	
	
}

Hi there! Thanks for taking the time to reply. I implemented the above code and was quickly able to download the file in question. However, the PDF files that is downloaded doesn't have the same size as the original - in fact all are 5Kb smaller, e.g.197Kb downloads to a 192Kb file, 241Kb to a 236Kb etc

I modified the OnPreHttp() method to set content length, but that had no effect.

/// Set the appropriate header for the file.
ClassMethod OnPreHTTP() As %Boolean
{
set filepath = %request.Get("filepath") set tFs=##class(%Stream.FileCharacter).%New()
set tFs.Filename=filepath set %response.ContentType = "application/pdf"
do %response.SetHeader("Content-Disposition","attachment;filename="""_$P(filepath,"\",*)_"""")
Do %response.SetHeader("Content-Length",tFs.Size)     Quit $$$OK
}
 

Do you have any ideas?

Thanks for the warning. Fortunately, this is for a internally hosted page accessed by username/password only by authorised operatives.

I solved the problem: user error! One of the variable values was misspelt in the database. Thanks for taking the time to answer!