Allows sending huge files to the client without having to use Response.Write() to load these files into FoxPro memory first, by directly transferring the file from disk.
This method can get around the 16 meg limitation of Visual FoxPro strings for request output in COM mode. TransmitFile is much more efficient at sending large files as it avoids loading both FoxPro and the ISAPI DLL with these large strings, but instead causes wc.dll to read output directly from file back to the client.
You can send files directly:
FUNCTION SendLogo Response.TransmitFile("c:\sites\MySite\Images\sailbig.jpg","image/jpeg") RETURN
or using virtual paths in your site:
FUNCTION SendLogo Response.TransmitFile("~/images/sailbig.jpg","image/jpeg") RETURN
You can also generate output dynamically to a file on disk. This is a good use case for the wwResponseFile class:
FUNCTION HugeOutput LOCAL lcOutputFile, loResponse *** Translate virtual path to physical path lcOutputFile = THIS.ResolvePath("~/temp/ + SYS(2015) + ".htm") *** Create a separate response object that writes to file loResponse = CREATEOBJECT("wwResponseFile",lcOutputFile) FOR x=1 TO 1000000 loResponse.Write("012345678901234567890" + "<br>") ENDFOR *** Release and close loResponse = .null. Response.TransmitFile(lcOutputFile,"text/html") *** Some housekeeping DeleteFiles(JustPath( lcOutputFile ) + "\_*.*",900) && timeout in 15 minutes ENDFUNC
The physical file name to return back to the client over HTTP:
or a virtual relative path:
Note: If you're using the Web Connection .NET Module the filename specified must be inside of the Web directory tree in order to be downloadable. This means any files from other locations first need to be moved or generated into a Web relative path. With the ISAPI handler the file can live anywhere.
The content type of the file you are sending back to the client. If omitted this.ContentType is used instead.
See also:Class wwPageResponse
Comment or report problem with topic