Skip to content

Instantly share code, notes, and snippets.

@cflove
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cflove/ac1cae5f4385e6d396b5 to your computer and use it in GitHub Desktop.
Save cflove/ac1cae5f4385e6d396b5 to your computer and use it in GitHub Desktop.
<cfheader name="content-disposition" value="attachment; filename=test.txt"/>
<cfheader name="X-Sendfile" value="D:\iis\hello.txt"/>
<cfcontent type="text/plain">
<!--- Add File size to the header, IIS returns "Overflow or underflow in the arithmetic operation." For large file sizes.
Also IIS try to allocate memory --->
<cfset filePath = "D:\iis\246.zip">
<cfheader name="content-disposition" value="attachment; filename=246.zip"/>
<cfset Response = GetPageContext().GetResponse() />
<cfset Response.setContentLength( createObject("java","java.io.File").init( filePath ).length() )>
<cfset Response.setHeader('X-Sendfile', filePath )>
<cfset Response.setContentType('application/octet-stream')>
<cfset Response.GetOutputStream().Flush() />
<cfset Response.Reset() />
<cfset Response.Finish() />
<cfheader name="content-disposition" value="attachment; filename=test.txt"/>
<cfset Response = GetPageContext().GetResponse() />
<cfset Response.setHeader('X-Sendfile','D:\iis\hello.txt')>
<cfset Response.setContentType('plain/text')>
<cfset Response.GetOutputStream().Flush() />
<cfset Response.Reset() />
<cfset Response.Finish() />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment