On Tue, 20 Jul 2004 16:00:24 -0700, Sean Corfield <[EMAIL PROTECTED]> wrote: > Confusing thread... If I read it right, the solution is to pass the > *name* of the field, e.g., "form.myFileField" as an argument (say > formField) and then in CFFILE use the *value* of the argument: > > <cffile fielfield="#arguments.formField#" ... /> > > So you call the CFC like this: > > <cfset result = myObj.uploadFile( "form.myFileField" ) /> > > No need to pass the entire form scope in or reference form scope > directly inside the CFC (although the CFFILE tag implicitly references > the form scope directly I suppose...).
Yes Sean, this summary is correct. However, this solution along with some issues I was having in another thread with cfsavecontent and cfoutput. Until the last couple of days, I was under the impression that CFCs were entirely their own encapsulated entities, assuming you followed best practices by not using the "this" scope, etc. However, what I've seen over the last couple days is that page-level settings "leak in" to the CFC "space." Here are a couple specific examples in case you haven't seen the other threads: 1) If I have cfsetting enablecfoutputonly="yes" at the top of my calling code, I need to put cfoutput around my cfsavecontent syntax within my CFC methods. Otherwise nothing is saved in the cfsavecontent variable. 2) If I'm uploading a file, the CFC apparently has access to the form scope in some way. If I pass in a literal string called "form.uploadFile" then the CFC can somehow "reach in" to the form scope of the calling page and get the file. My overriding question to this is: Is it acceptable to have elements of the calling code available automatically to the CFC space? "Acceptable" is probably not the best word to use, but I can't think of a better one. The way I always thought of CFCs is that I need to explicitly tell it what I want it to do and/or explicitly pass in any value I want it to have rather than have it pull in the calling page settings. Does that question make sense? Any insight is appreciated. Regards, Dave. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
