Why is ExpandPath returning two different results?

SiobhanElara
SiobhanElara used Ask the Experts™
on
When using ExpandPath, I will occasionally get something unexpected. For instance, I'm trying to move a file from one directory to another.
<cffile action="MOVE" source="#ExpandPath('/tmp/bloop.jpg')#" destination="#ExpandPath('/final-images/bloop.jpg')#">

Open in new window


This is the error I'm receiving:
An exception occurred when performing a file operation moving a file to another filesystem on files /var/www/vhosts/[sitename].com/tmp/bloop.jpg and /opt/coldfusion10/cfusion/bin/redirect:/final-images/bloop.jpg.The cause of this exception was: java.io.FileNotFoundException: /opt/coldfusion10/cfusion/bin/redirect:/final-images/bloop.jpg (No such file or directory).

You'll notice that the expanded base of the source is /var/www/vhosts/[sitename].com (which is what you'd expect it to be) while that of the destination is /opt/coldfusion10/cfusion/bin/redirect:

What's going on here? This isn't the first time I've run across this issue, but I can't seem to Google anything up about it. We're running CF10 on a Linux server. Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kent OlsenData Warehouse / Database Architect

Commented:
Hi SiobhanElara,

I'm no ColdFusion expert.  

But I know that ExpandPath has long history of unusual behavior.  Most folks that I know don't use ExpandPath, preferring a solution something like this:

  this.directory = getDirectoryFromPath( getCurrentTemplatePath() );


HTH,

Kent

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial