-1

If I use coldfusion's getTempDirectory() as the path to generate a file, is there any way for a browser to access that? Or, if not, can I configure the temp path to be a certain folder?

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Patrick Schomburg
  • 2,494
  • 1
  • 18
  • 46
  • Some of us who might know the answer are too lazy to select your hyerlink. – Dan Bracuk Dec 01 '16 at 17:04
  • The example in the documentation you point us to suggests that the answer is yes. What did you unsuccessfully try that led you to posting this question? – Dan Bracuk Dec 01 '16 at 18:25
  • So the directory is something like c:/user/temp. A browser can't access that, as far as I know. – Patrick Schomburg Dec 01 '16 at 18:35
  • 1
    @PatrickSchomburg it can, if you tell your server to serve it.. probably not a good idea though. it's outside the webroot for a reason. – Kevin B Dec 01 '16 at 19:34

1 Answers1

8

You could serve the content using the cfcontent tag. It reads the file and sends the contents to the browser.

<cfcontent  
    type = "text/html"  
    file = "#getTempDirectory()#\myfile.htm"  
    deleteFile = "No"> 
Leigh
  • 28,765
  • 10
  • 55
  • 103