-
<cfcomponent name="fileFunctions" displayname="File Functions" hint="I handle file functions for the site" output="false">
-
<!---
-
++++++++++++++++++++++++++++
-
+ UPLOAD FILE
-
++++++++++++++++++++++++++++
-
--->
-
<cffunction name="uploadFile" access="public" output="false" returntype="string" hint="returns name of file uploaded">
-
<cfargument name="destination" type="string" required="true" hint="This is the destionation where the file is to be uploaded" />
-
<cfargument name="fileField" type="variableName" 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" />
-
<!--- upload file --->
-
<cffile action="upload" destination="#arguments.destination#" filefield="#arguments.fileField#" accept="#arguments.acceptType#" nameconflict="#arguments.nameConflict#" />
-
<cfreturn file.serverFile />
-
</cffunction>
-
<!---
-
++++++++++++++++++++++++++++
-
+ RENAME FILE
-
++++++++++++++++++++++++++++
-
--->
-
<cffunction name="renameFile" access="public" output="false" returntype="void" hint="renames an exisiting file on the site">
-
<cfargument name="source" type="string" required="true" hint="this is the name of the file to be renamed" />
-
<cfargument name="destination" type="string" required="true" hint="this is the new name the file" />
-
<cffile action="rename" source="#arguments.source#" destination="#arguments.destination#" />
-
-
</cffunction>
-
<!---
-
++++++++++++++++++++++++++++
-
+ REMOVE FILE
-
++++++++++++++++++++++++++++
-
--->
-
<cffunction name="removeFile" access="public" output="false" returntype="void" hint="removes an exisiting file from the site">
-
<cfargument name="fileName" type="string" required="true" hint="this is the name of the file to be removed" />
-
<cfargument name="filePath" type="string" required="true" hint="this is the path of the file to be removed" />
-
-
<cfscript>
-
var fullFilePath = arguments.filePath & arguments.fileName;
-
</cfscript>
-
<!--- if the files exist delete them --->
-
<cfif fileExists(fullFilePath)>
-
<cffile action="delete" file="#fullFilePath#" />
-
</cfif>
-
</cffunction>
-
</cfcomponent>