|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Confused......
Ok, I set up a new site on my IIS server, running on Win2003. I had previously had other sites working with ColdFusion just fine. I am setting up this site so it uses default.cfm instead of the standard default.htm (or maybe not so standard!!).
My other sites are stored in a directory that is not under the wwwroot directory, and I've noticed that eventually a CFIDE folder appears, along with other CF folders, and at that time, CF works great. I decided to take someones advice and put this new site in a folder inside the wwwroot folder. CF doesn't seem to be working. I have a section of code that is: <cffile action="read" file="../TXT/News.txt" variable="News"> <cffile action="read" file="../TXT/News2.txt" variable="News2"> <cffile action="read" file="../TXT/News3.txt" variable="News3"> And lower on the page, have a: <cfoutput> #News# #News2# #News3# </cfoutput> When the page is displayed, when it gets to the variables, on the page I simply get #News#, and not the info in the variable. Can anyone give a guy a hand????? Thanks! Steve |
|
#2
|
|||
|
|||
|
If it is a separate site in IIS you will need to add mappings for the .cfm extension to map this to the ColdFusion .dll files so that IIS knows what to do with the CF page.
http://www.macromedia.com/support/c..._cf_win2003.htm
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
I moved the files to a CF site that I know works, and now I'm getting a error message of:
An error occurred when performing a file operation read on file C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\wwwroot-tmp\../News.txt. The cause of this exception was: java.io.FileNotFoundException: C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\wwwroot-tmp\..\News.txt (The system cannot find the file specified). The error occurred in C:\Web Sites\Scooter2\test1.cfm: line 5 3 : <title>Untitled Document</title> 4 : </head> 5 : <cffile action="read" file="../News.txt" variable="News"> 6 : <cffile action="read" file="../News2.txt" variable="News2"> 7 : <cffile action="read" file="../News3.txt" variable="News3"> The thing is my text file isn't in c:\CFusionMX\runtime\servers...etc file, they are in the root directory of the web site, that's why I have the path listed as ../News.txt How can I get this to work? Steve Quote:
|
|
#4
|
|||
|
|||
|
Try using the full path, not ../. CF uses a temp directory (that you can see with the function getTempDirectory()), and it may be starting there. Use something like getCurrentTemplatePath() or getDirectoryFromPath() to hand CFFILE a full directory path.
|
|
#5
|
|||
|
|||
|
Can you provide what a sample of the code would look like with the getTempDirectory()) command would be, and how it hands that info to CF?
Thanks!! Quote:
|
|
#6
|
|||
|
|||
|
It's all in the docs.
<cfoutput> #getTempDirectory()<br> #getDirectoryFromPath( getCurrentTemplatePath() )#<br> </cfoutput> |
|
#7
|
|||
|
|||
|
I guess I'm a little confused why I'd want the TempDirectory() and DirectoryFromPath(getCurrentTemplatePath()) to run.
I get the idea that it will return the CF temp directory, what the temp is currently set to, and the DirectoryFromPath just returns the directory of the current templates. But how does that help? Since the files I want to read aren't in the directory that may be returned. Steve Quote:
|
|
#8
|
|||
|
|||
|
I'm just showing you the functions so that you could try and see if that's why CF was looking in the wrong place when you wern't specifying a full path. One way or the other you will have to feed a full directory path to CFFILE. Whether you pass it a full path outright, or use functions like getTemplatePath(), expandPath(), or any of the other directory-related functions is up to you. But either way you'll need a means of determining the full path to the file. Take a look through the docs and find one or a combination that will work for you (there's always a way to do it, it just depends on what you need). Try #expandPath( '../news.txt' )# as a start.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Confused...... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|