ColdFusion ServerFile is undefined in CFFile

2019-08-09 11:32发布

问题:

When I try to run the following code, I'm getting the error message: "Element SERVERFILE is undefined in CFFILE.". I've done this a million times. Can anyone see what I'm missing?

    <cffile action="upload" fileField="fileField" destination="xxxx" 
        nameConflict="Overwrite" result="thisResult">
    <cfoutput>#cffile.ServerFile#</cfoutput>

回答1:

You are using the result attribute. So instead of cffile.serverFile, use thisResult.serverFile.

Result Lets you specify a name for the variable in which cffile returns the result (or status) parameters. If you do not specify a value for this attribute, cffile uses the prefix cffile. For more information, see Usage.