Skip to main content
Inspiring
December 20, 2006
Question

CFFILE Rename/Move Error? Glitch?

  • December 20, 2006
  • 15 replies
  • 5478 views
I have an application that needs that processes a file and needs to rename the file when it finishes processing. I keep getting an (apparently common) error stating:

Attribute validation error for tag CFFILE.
The value of the attribute source, which is currently "C:\Program Files\cigna\excel2querytest.xls", is invalid.

I've noticed the same thing that many people who have posted about this error have: sometimes the process flows through without any errors. The error occurs whether the source/destination is hard coded or is stored in variables. The error occurs whether I use action="RENAME" or action="MOVE". A test using FileExists() always returns true. Before I execute the code I always make sure that the original file exists, and the destination file does not.

Does anyone know what is causing this problem and if there is a work-around? It seems like this is a pretty nasty bug in CF that a fair number of people have come across (FYI I'm using CFMX7).

Any help would be greatly appreciated.

Thanks!

This topic has been closed for replies.

15 replies

Inspiring
December 26, 2006
Can you do a <cffile action="WRITE"> to the destination path? Don't
believe the cause of the error when CF reports errors with <cffile>: it
gets confused easily.

Not that it's any help, or tells us much, but you code works fine for me
(same path).

--
AAdam
Inspiring
December 26, 2006
> Place the following tag at the top to remind Coldfusion about the XSL extension
> <cfcontent type="application/vnd.ms-excel">

All that does is insert an HTTP header in the response, telling the client
browser how to handle the data. It has no bearing on anything the CF
server does, internally.

--
Adam
BKBK
Braniac
December 26, 2006
Place the following tag at the top to remind Coldfusion about the XLS extension

<cfcontent type="application/vnd.ms-excel">






December 22, 2006
I notice you are working with excel files. Excel does not play nice with file locks and sharing.

If excel is open or has just shutdown, it will lock the file and you can't rename it.

Wait about 1500 milliseconds and/or use Java to check for a file lock before trying to rename the file.

Also, file a bug report because the cffile error message is worse than useless, it's misleading!

Inspiring
December 22, 2006
2 possibles you can test:

1. space in the path - try the same code but using a path without spaces
2. permissions - try mode="777"

<cffile action="RENAME" source="#sServerPathFull#" destination="#sNewFile#" mode="777" attributes="Normal">