Copy link to clipboard
Copied
I'm migrating files from Windows ColdFusion 2018 to Linux ColdFusion 2018. On the Windows Server, I can successfully run the following code:
<cffile action="rename" source="#srcDIR#" destination="#destDir#\#form.memID#.PNG" nameconflict="overwrite">
Where #srcDIR# is the path to the image that needs to be moved. But on Linux, the same command below fails "The source ... specified in the cffile tag is invalid." I added a CFIF FileExists check and it's returns as true, so #srcDIR# can be found.
<cffile action="rename" source="#srcDIR#" destination="#destDir#/#form.memID#.PNG" nameconflict="overwrite">
If I change the cffile to move and remove nameconflict as shown next, it works:
<cffile action="move" source="#srcDIR#" destination="#destDir#/#form.memID#.PNG">
Anybody have a clue why rename fails, but move works?
Copy link to clipboard
Copied
Does rename work after you remove the nameConflict attribute? If what I am thinking is correct, then that will produce the same error.
What I am thinking is as follows: the rename is actually equivalent to moving the file #srcDIR# to the new location #destDir#/#form.memID#.PNG.
After that, the file #srcDIR# no longer exists. Hence the error. Unless in the case when the paths #srcDIR# and #destDir#/#form.memID#.PNG are the same.
Copy link to clipboard
Copied
Hey BDBK
No, it didn't work when I removed the nameConflict attribute. I ended up sticking with move and continue working. Just thought it was strange that rename worked on Windows server, but not on a Linux server.
Copy link to clipboard
Copied
Thanks for the update.
If it works on Windows but not on Linux, then that might be a bug. I would suggest you report it.