Answered
CFFILE write
I am trying to create a file using the cffile tag and the
following code:
<cfset rootPath = #expandpath("../.")#>
<cfsavecontent variable="controllerScript">
Text to write to file
</cfsavecontent>
<cfif NOT FileExists( ExpandPath( "..\controllers\#url.table#Controller.cfm" ) )>
<cffile action="write" file="#rootPath#\controllers" output="#controllerScript#" nameconflict="error">
\controllers\#url.table#Controller.cfm has been written<br />
<cfelse>
\controllers\#url.table#Controller.cfm all ready existed<br />
</cfif>
When I execute this on my localhost (win xp pro) I get the following error:
An error occurred when performing a file operation write on file C:\Documents and Settings\Jason\My Documents\Sites\devArena\controllers.
The cause of this exception was: java.io.FileNotFoundException: C:\Documents and Settings\Jason\My Documents\Sites\devArena\controllers (Access is denied).
I set the write permissions in IIS and have tried to remove read-only access from all the folders. Directly above this code I do have another piece of code that creates the controllers folder if it does not exist. Is that a problem? Anyone see something that I am missing?
Thanks
<cfset rootPath = #expandpath("../.")#>
<cfsavecontent variable="controllerScript">
Text to write to file
</cfsavecontent>
<cfif NOT FileExists( ExpandPath( "..\controllers\#url.table#Controller.cfm" ) )>
<cffile action="write" file="#rootPath#\controllers" output="#controllerScript#" nameconflict="error">
\controllers\#url.table#Controller.cfm has been written<br />
<cfelse>
\controllers\#url.table#Controller.cfm all ready existed<br />
</cfif>
When I execute this on my localhost (win xp pro) I get the following error:
An error occurred when performing a file operation write on file C:\Documents and Settings\Jason\My Documents\Sites\devArena\controllers.
The cause of this exception was: java.io.FileNotFoundException: C:\Documents and Settings\Jason\My Documents\Sites\devArena\controllers (Access is denied).
I set the write permissions in IIS and have tried to remove read-only access from all the folders. Directly above this code I do have another piece of code that creates the controllers folder if it does not exist. Is that a problem? Anyone see something that I am missing?
Thanks
