Anthony Israel-Davis wrote, On 3/29/2007 11:39 AM:
I would suggest a design that has a high amount of reuse (that's one of
the reasons for using a CFC!) so instead of passing in the entire form
structure and depending on the form names, you may want to consider
passing in each attribute individually and returning the cffile variable
for additional processing. Here's an example:
That's true. You should only use the entire form scope if you intend to
you all of it (or, perhaps if you have another really good reason)
<cffunction name="upload" access="public" output="false"
returntype="struct" hint="returns the cffile struct">
<cfargument name="fileField" type="string"
required="true" hint="This is the name of the form field that contains
the file">
<cfargument name="acceptType" type="string"
required="false" default="" hint="Valid File Types">
<cfargument name="nameConflict" type="string"
required="false" default="MakeUnique" hint="nameConflict value for
cffile">
... MORE CODE HERE ...
<cfreturn cffile> <!--- OR Whatever you name your return variable --->
</cffunction>
anthony
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy
Larbi
Sent: Thursday, March 29, 2007 9:12 AM
To: [email protected]
Subject: Re: [CFCDEV] Uploading Files and CFCs
Ryan Everhart wrote, On 3/29/2007 6:25 AM:
This may be a dumb question, but can you use a cfc to upload files?
Do they have access to the form scope when executed? The way my
application is being built is sorta like a framework where I have
pages called views which display all my data then I have action pages
which do stuff like add/remove/update data in the db via CFCs. So my
question is, on an action page can I call a component that will be
able to upload a picture from a form, or do i have to do the actual
upload on the action page itself then do any other actions (rename,
move, add file name to db) on the cfc. Thanks! I've been thinking
about this all night but haven't tested it out yet.
Try it out! CFCs do have access to the form scope, but generally I
think people tell you to only depend on a structure, and pass in the
form scope instead. I think I have actually tried uploading a file in
one, so assuming I'm not making up past experiences (which, on occasion
I probably have done), I'm pretty sure it will work.
You are subscribed to cfcdev. To unsubscribe, please follow the
instructions at http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]