ColdBox Framework Forums Notification: Post to File Upload using file plugins

Title: RE: File Upload using file plugins
Thread: File Upload using file plugins
Forum: Need Help?
Conference: ColdBox
User: jjhodoro jcyr,

This is the code I've added to the fileUtilities plugin (now the
Utilities plugin) to serve as a facade for cffile. I sent it to Luis awhile back
but it wasn't added to the latest build of Coldbox.

[code]
<cffunction
name="uploadFile" access="public" hint="Facade to upload to a file"
returntype="any" output="false">
    <!---
************************************************************* --->
<cfargument name="FileField" type="any" required="yes" hint="The name of
the form field used to select the file">
    <cfargument name="Destination"
type="any" required="yes" hint="The absolute path to the destination.">
<cfargument name="NameConflict" type="string" required="false"
default="Error" hint="Action to take if filename is the same as that of a file
in the directory.">
    <cfargument name="Accept" type="string"
required="false" default="" hint="Limits the MIME types to accept.
Comma-delimited list.">
    <!--- *************************************** --->
<cffile action="upload" filefield="#arguments.FileField#"
destination="#arguments.Destination#" nameconflict="#arguments.NameConflict#"
accept="#arguments.Accept#">

    <cfreturn cffile>
  </cffunction>

  <!---
******************************************** --->

  <cffunction
name="renameFile" access="public" hint="Facade to rename to a file"
returntype="void" output="false">
    <!---
******************************************* --->
    <cfargument name="Source"
type="any" required="yes" hint="Pathname of file to rename.">
    <cfargument
name="Destination" type="any" required="yes" hint="The absolute path to
the destination.">
    <!--- ******************************************* --->
<cffile action="rename" source="#arguments.Source#"
destination="#arguments.Destination#">

  </cffunction>

  <!---
********************************************** --->

  <cffunction
name="copyFile" access="public" hint="Facade to copy to a file"
returntype="void" output="false">
    <!---
*********************************************** --->
    <cfargument
name="Source" type="any" required="yes" hint="Pathname of file to copy.">
<cfargument name="Destination" type="any" required="yes" hint="The
absolute path to the destination.">
    <!---
********************************************* --->

    <cffile action="copy"
source="#arguments.Source#" destination="#arguments.Destination#">
</cffunction>

  <cffunction name="moveFile" access="public" hint="Facade to
move to a file" returntype="void" output="false">
    <!---
****************************************** --->
    <cfargument name="Source"
type="any" required="yes" hint="Pathname of file to move.">
    <cfargument
name="Destination" type="any" required="yes" hint="The absolute path to
the destination.">
    <cfargument name="CharSet" type="string"
required="false" default="utf-8" hint="CF File CharSet Encoding to use.">
<cfargument name="CheckCharSetFlag" type="boolean" required="false"
default="false" hint="Check the charset.">
    <!---
******************************************* --->

    <!--- Verify File Encoding
to use --->
    <cfif arguments.CheckCharSetFlag><cfset arguments.charset =
checkCharSet(arguments.CharSet)></cfif>
    <cffile action="move"
source="#arguments.Source#" destination="#arguments.Destination#"
charset="#arguments.charset#">

  </cffunction>
[/code]
http://forums.coldboxframework.com/index.cfm?event=ehMessages.dspMessages&threadid=8940829C-123F-6116-42D23495D2A079E3