An incredibly usefull CFFILE error message
I thought I’d blog about this because I haven’t found any mention of it anywhere else on the web.
I was working with CFFILE today and the tag kept throwing the following error while attempting to move a file:
Attribute validation error for tag CFFILE.
The value of the attribute source, which is currently "C:\JRun4\ser...\cfusion-war-tmp\uploaded-file.dat", is invalid.
I must’ve spent half an hour trying to figure out why the path in the source attribute was invalid. The path was correct, the file was there, everything about the source attribute was fine!
I finally decided to check the other attributes just in case (yeah, I know, I should’ve done that much much earlier). It turned out the destination path was pointing to a folder that didn’t exist. So it wasn’t the source attribute that was invalid but the destination attribute. I did a few tests and I found out that the only invalid value of the destination attribute that actually throws a meaninful error is an empty string. Any other invalid path throws the source attribute error.
Note: This was on CFMX7. No idea whether this also happens on other ColdFusion server editions.

July 1st, 2009 at 7:03 pm
I had the same error message but it was for
I was uploading a file to a temporary directory and checking the application type and file extension. Assuming those tests passed, I took the current source file and renamed it to an archive directory. Then, I moved the temp to the directory I needed it in.
The problem occurred if someone one previewed the file before uploading the replacement file. After trolling around, I found that many people had problems using “rename” and so I used “copy” instead. Since I was renaming the file and saving it to the archive location already, rename was not needed. I guess there is a bug with the “rename” attribute of CFFILE.
Here’s the link where I found my solution:
http://livedocs.adobe.com/cold.....gs-p34.htm
November 22nd, 2008 at 12:58 am
CaddyX, i’m still getting that error though i’ve put some sort of loop there.
May 2nd, 2008 at 5:16 pm
ah. I hit the code strip too. Anyways, the CFIF uses DirectoryExists( to check for it, and creates it if not.
May 2nd, 2008 at 5:14 pm
The original post here talks about an error thrown when the target directory doesn’t exist. I got around this by throwing in a CFIF at the beginning:
<cfdirectory action=”create”…
February 28th, 2008 at 9:17 pm
Hmmm. I guess the code gets stripped out here? Anyway, here’s a verbal description of the loop.
Set a variable to 0
Use a CF condition loop with the condition being variable = 1
Use cfif FileExists to see if the file is in its uploaded destination.
If it is, set the variable to 1
ELSE set variable to 0.
You may not need the ELSE, but it works this way.
February 28th, 2008 at 9:12 pm
Just FYI for anyone who lands on this page because they are struggling with this problem.
I had a CFFILE rename tag that was working fine and then one day it didn’t. My solution was the one Martin mentioned in #7 that Big b had suggested. Apparently the file doesn’t get uploaded before the rename takes place, so you must kill some time while it is being uploaded. I used the following loop:
<cfif FileExists(”path/filename.ext”)
September 4th, 2007 at 6:42 am
Nice
January 30th, 2007 at 7:43 pm
I am getting the same error trying to “move” file from one server to CF server to be emailed. If I go to Start ->Run and enter the UNC path of the directory I am trying to access, I can see the file. Same with the CF server: I can see the directory.
But when I do the following :
I am getting that ugly error:
Attribute validation error for tag CFFILE.
Please help