ColdFusion, WordPress, Flash & other web things


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.

16 comments

Pages: [2] 1 » Show All

#16: Dennis Belmont Says:

ah. I hit the code strip too. Anyways, the CFIF uses DirectoryExists( to check for it, and creates it if not.

#15: Dennis Belmont Says:

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”…

#14: CaddyX Says:

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.

#13: CaddyX Says:

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”)

#12: Paulos Says:

Nice

#11: Eugene Says:

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

Pages: [2] 1 » Show All

Leave a comment




You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser