This function will upload a file.

http://coz.pastebin.com/f4eb4bbaa

The full CFC is on my interblog if you are interested.....

http://www.myinternetisbroken.com/files/FileUpload.cfc.zip

Here is the basic usage for the cfc

   <cfif    NOT isdefined("application.FileUpload" )>
      <cfset application.FileUpload = createObject("component",
"FileUpload").init()
>
   </cfif>

<cfscript>
      uppload = application.FileUpload.upload("form.MyFile", mypath,
"Prefix_");
</cfscript>


I have another version at work that abstracts the code that cleanses the
file name to another function. I should prolly update the one on my site.

G!

On Sat, Mar 7, 2009 at 2:21 PM, Chad Gray <[email protected]> wrote:

>
> I have a user submitting an image via a form.
>
> I would like to make a function in my cfc to upload the file.  What do I
> put in the fileField attribute of CFFile?
>
> Arguments.TitleImage or Form.TitleImage?
>
> What type do I set for the cfargument?  String?  Binary?
>
>
> <cffunction name="updateProductImages" access="public" returntype="void">
>        <cfargument name="CatID" type="numeric" required="yes">
>        <cfargument name="TitleImage" type="string" required="yes">
>
> <cffile action="Upload" filefield="arguments.TitleImage"
> destination="#application.ProductPageImages#" nameconflict="makeunique">
>
> </cffunction>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320212
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to