Question

My page has a form on it that interacts with a CFC via an ajax post. When the user changes the text and clicks save it should update the DB, which it does, and rename a photo with the value they typed in. Everything works except that I keep getting the error:

The value of the attribute source, which is currently /Applications/ColdFusion8/wwwroot/theClient/staging/admin/images/Old_Image.jpg, is invalid.

The file exists and I've changed it to read/write for everyone but ti still gives me the error.

Any ideas?

I should point out that a var in my CFC runs a replace for spaces and changes them out for underscores so, there's no spaces in the filename...

Was it helpful?

Solution

If I remember right this is probably a problem with the destination file name rather then the source filename. I think it's a bug with the error message in CF.

OTHER TIPS

The problem might be that you are using a relative path to the source file. The problem is, relative links in the source attribute are relative to the ColdFusion temporary directory. Try giving an absolute path or using the EXPANDPATH function to create an absolute path to your resource like this:

<cffile action="rename" source="#expandPath('/Applications/ColdFusion8/wwwroot/theClient/staging/admin/images/Old_Image.jpg')#" destination="#expandPath('/Applications/ColdFusion8/wwwroot/theClient/staging/admin/images/NEW_Image.jpg')#">

From the CF 9 documentation on CFFILE action="rename"

If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function.

I had the same issue and in the end it was something else: the ColdFusion user had no "modify" permission in the folder. It had read/write but not modify. (sigh!)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top