views:

121

answers:

3

When working with cffile in ColdFusion, after an upload of a file to a webserver, the cffile structure is created that is supposed to have a value in it called "oldFileSize". Every time I do an upload and examine that value, it has the new file's size, not the overwritten file's size. Is there some setting somewhere to correct that or is this a bug in cffile in cf8?

Clarification: If you use the cffile command to upload a file to a server, it will attempt to store that file in the location you tell it in the command. If the destination already has a file there with the same name and path, then one of the options in your cffile command can bet to overwrite any existing file. If you do that, a structure is returned called cffile with an attribute called "oldFileSize". The documentation states that oldFileSize should be the size of the file that was overwritten. Instead, it's returning the size of the file being uploaded.

A: 

What overwritten file? It seems you are talking about two files when you only refer to one.

jdelator
+2  A: 

If the oldfilesize attribute is not returning correctly, I would use nameconflict=unique to preserve the old file. Then, you can use cfdirectory to check the old filesize, and cffile action="delete" and action="rename" to replace the old file, so that you have essentially overwritten the old file, only manually.

A bit of work, but if you need the information....

Ben Doom
+1  A: 

Ben Doom is correct about the work-around to the problem, but if you're not seeing the documented behavior, that's a bug and you should report it! Currently, there is no public bug tracker you can submit to (although there is a push for one and we should probably see it soon-ish), so the defacto standard is to post it as a comment on the documentation page.

Adobe staff does read and respond to comments and they will likely either respond that it will be fixed, or acknowledge that it is a bug but indicate there is no plan to fix it at this time. Either way, the responsible thing to do is to report the bug.

Adam Tuttle