I am trying to do this
<cfset noncooperativevariable = #serverfile#>
and I get a serverfile not defined error. When I try to use the correct variable scope
<cfset noncooperativevariable = #CFFILE.serverfile#>
which returns the error.
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
Edit:
<cffile action="upload" filefield="fileUpload" destination="#destination#" nameConflict="makeUnique" result="upload">
<cfset noncooperativevariable = #fileUpload.serverfile#>
When using the
cffiletag, the results are defaulted to the cffile struct in your Variables scope. Therefore, if you are uploading a file with the following code:The results are accessible via the cffile struct in your Variables scope. The filename would be referenced as follows:
In the snippet posted, you are using the ‘result’ attribute which would place your cffile results in the struct named upload instead of cffile, so you would get the filename like so: