Copy link to clipboard
Copied
Hi I have a page builder form and when the user is finished building her page, she can click "Write File" and the file will actually be saved to a particular folder as an html file. All this worked fine until I wanted to try and save these new files to a network shared folder so that our employer could copy the files over to his pc and review them before uploading to the remote server.
Here is the new file path variable and the path I assigned to it.
<!--- Set Path and File Name --->
<cfset fileExtension = ".html">
<cfset pathToFile = "C:\webdes-pc\newPageFiles">
<cfset fileToWrite = pathToFile & SESSION.fileName & fileExtension>
Here is the original code that worked perfectly.
<!--- Set Path and File Name --->
<cfset fileExtension = ".html">
<cfset pathToFile = "C:\ColdFusion8\wwwroot\replacememntlightbulbs\pageBuilder\">
<cfset fileToWrite = pathToFile & SESSION.fileName & fileExtension>
Is there a reason why I could not write a file to a networked folder? I would have thought there wouldnt have ben a problem with that idea. Thanks for any help in advance!
Copy link to clipboard
Copied
lol nevermind! As I was typing this post I noticed I didn't have the backslash at the end of my folder name. Sorry for the dumb post!
Copy link to clipboard
Copied
<cfset pathToFile = "C:\webdes-pc\newPageFiles\">
That worked? That looks like a mapped folder and those usually do not work because ColdFusion runs as a different user then the whomever might have mapped the folder?
What usually works is a UNC path more like "\\webdes-pc\newPageFiles\" after ColdFusion has been configured to run as a domain user that has the permissions to that network path rather than the default "localSystem" user which usually has NO network permissions.
Copy link to clipboard
Copied
ilssac wrote:
<cfset pathToFile = "C:\webdes-pc\newPageFiles\">
That worked? That looks like a mapped folder and those usually do not work because ColdFusion runs as a different user then the whomever might have mapped the folder?
What usually works is a UNC path more like "\\webdes-pc\newPageFiles\" after ColdFusion has been configured to run as a domain user that has the permissions to that network path rather than the default "localSystem" user which usually has NO network permissions.
Actually you might be right. I think I have a folder named webdes-pc in my C drive as well. I had the file path set as \\webdes-pc\newPageFiles\ as you suggested before, but might have not had the last backslash on there either. So I think when I get to work tomorrow I will try this path again. Thanks!
Copy link to clipboard
Copied
It is a best-practice not to use backslahes in paths. Forward slashes will work on Windows too - and on every platform.
Only when you're for example creating .BAT files, or passing path-containing parameters with CFEXECUTE, you may need backslashes in Windows.
-Fernis