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.

June 24th, 2005 at 2:48 pm
On CFMX 6.1 I’m getting “…(The system cannot find the path specified)”, with it giving the destination path.
June 28th, 2005 at 6:51 pm
I have the same error . Is anybody has a solution for that.
Thanks in advance.
June 28th, 2005 at 8:11 pm
To the person with no name: My post describes an inaccuracy with MX7 CFFILE error messages. What do you need a solution for?
August 26th, 2005 at 2:00 am
Anonymous, I believe, didn’t understand that nature of this article but is experiencing a problem that I recently had. The solution I arrived at is detailed in the link below but can be summed up by simply pointing out to MX7 that the source file does exist before attempting an action on it. It’s hard to explain so check it out here:
MX7 CFFILE Rename Error
December 20th, 2005 at 4:34 pm
I’ve seen this on CF6.1 and likewise it was the destination that was the issue. The destination existed but had permission issues.
January 30th, 2006 at 2:25 am
Anybody know what Big b was talking about? The link he provides is now dead, and I seem to be having that problem. The source and destination attributes are both okay. Windows shows that the permissions are fine on the folders, but it’s still throwing that error.
January 31st, 2006 at 8:41 pm
J Lane: if I recall correctly, Big B was talking about something unrelated to this post. The technique he explained on his site was simple: when you upload a file via CFFILE and you then want to do something with it (like move it), you need to wait for the file to be fully written to disk.
You can do this by looping while the file doesn’t exist.
Does this answer your question?
January 31st, 2006 at 9:05 pm
Sort of. I actually managed to figure out the problem I was having yesterday. I have a series of sites existing in different folders on the same server. I keep the path information for each folder in a database (so that it’s easy to update if the server config changes, for example).
The problem I was having was in using this path from the database in the source/destination attributes in a cffile rename. It’s weird, and I don’t know why it worked, but if I set the path to a variable first and then used the variable in the cffile attributes, it worked. If I try to use the result directly, it fails.
February 14th, 2006 at 2:58 pm
In response to Martin, or anyone who can clarify. I thought that CFFILE will create the destination directory if it does not exist. I am currently doing just that, using a directoy named after a session variable value in the destination attribute.
This behaviour is working fine when testing CFFILE with upload action on my machine, but is not working on my webhost.
Can someone provide a solution?
Thanks
tomasz.
August 9th, 2006 at 9:47 pm
Thanks for posting this.., this was exactly my problem with the source error and it actually being the destination.
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
September 4th, 2007 at 6:42 am
Nice
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”)
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.
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”…
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.