Copy link to clipboard
Copied
I am trying to use a mapped drive with cfftp. I've changed Coldfusion to run as the user with the mapped drive access in services. This works:
localfile ="c:\foo\bar.txt"
This doesn't. I get an error (The system cannot find the path specified).
localfile ="m:\foo\bar.txt"
To see if it was a cfftp issue I tried:
<cfset dir = DirectoryList("c:\") />
<cfdump var="#dir#">
<cfset dir = DirectoryList("m:\") />
<cfdump var="#dir#">
M returned an empty array.
Any suggestions? Thanks!
I set up a test to ftp a file from a remote server and store the file to a mapped drive on my local NAS and it successfully copied the file, using FTP, from the remote to my NAS. The NAS has a shared folder "ftptest", the trick is to allow the CF server to access the UNC path without specifying user/password. In my test I gave the share guest access so no user & password needed so if you can give the user running CF access to the share using the server user credentials, using AD maybe, it should
...Copy link to clipboard
Copied
Hello, ghanna1,
I can't say for sure, but I'll make an attempt. Mapped network drives are on a different system/machine, and since the cfftp is for File Transfer Protocol, it can't transfer between two remote systems; only between the local system and a remote system. You'd have to copy the file from the remote system source to your local system, then use cfftp to xfer the file to a remote system.
Again, just a stab in the dark. But it's logical, to me. I know this isn't the answer you wanted to hear.
HTH,
^ _ ^
Copy link to clipboard
Copied
For a user to access the mapped drive it has to be mapped, just because you are running ast the user with permission to map the drive it does not mean the drive has been mapped for the session CF is running in. A better solution would be to refer to the remote drive with a UNC path, e.g. \\remoteservername\remotesharename\
Copy link to clipboard
Copied
The link I am going to paste, here, is specifically for WinSCP, but holds true for (I believe) all FTP application.
https://winscp.net/eng/docs/faq_fxp
tl;dr - SFTP doesn't allow this to happen. Theoretically SCP could, but there are no known cases.
V/r,
^ _ ^
Copy link to clipboard
Copied
I set up a test to ftp a file from a remote server and store the file to a mapped drive on my local NAS and it successfully copied the file, using FTP, from the remote to my NAS. The NAS has a shared folder "ftptest", the trick is to allow the CF server to access the UNC path without specifying user/password. In my test I gave the share guest access so no user & password needed so if you can give the user running CF access to the share using the server user credentials, using AD maybe, it should be able to access the share.
<cfftp
connection="TestFTP"
stoponerror="yes"
action = "getfile"
directory="test"
remotefile="/test/test.txt"
localfile = "\\nas1\ftptest/test.txt"
passive = "yes"
failifexists = "no">
Copy link to clipboard
Copied
That did it! Thanks. I had tried something similar using the IP instead of the name but I tried all the \ going one way then all going /. The mix of \ and / is what did the trick.