Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--- CFFUNCTION :: --->
- <cffunction name="CMYK_My_Upload_MultiMethod" access="public" returnType="struct"
- hint="Handles the upload functions for local CFFILE method of uploading.">
- <!--- CFARGUMENT :: AcceptedFileTypes --->
- <cfargument name="AcceptedFileTypes" type="String" required="No" hint="The type of files accepted. Example: image/jpg,image/jpeg" default="Any" />
- <cfargument name="FileFieldName" type="String" required="No" hint="The name used for the form field to process. Example: FORM.Portfolio_Avatar" default="" />
- <cfargument name="DestinationPath" type="String" required="Yes" hint="The full path to the directory where the destination directory is stored." default="/var/www/vhosts/cmykmag.com/DataVault" />
- <cfargument name="DestinationFolder" type="String" required="Yes" hint="The folder where the file is stored." default="temp" />
- <cfargument name="NameConflict" type="String" required="No" hint=" Options: makeunique, rename, overwrite, skip" default="makeunique" />
- <cfargument name="UploadMethod" type="String" required="Yes" hint=" Options: local, ftp" default="local" />
- <cfargument name="FTPLocalFile" type="String" required="No" hint="Pass the filename if FTP method" default="" />
- <!--- CFSCRIPT :: Call the appropriate CFC --->
- <cfscript>
- // INVOKE CMYK_My_Upload_Local [ Initialize CFC ]
- MyUpload_init = createObject("component","cfc_cmyk_upload.cfc");
- // LOGIC :: LOGIC :: If the defined method is assigned for local uploads...
- if (ARGUMENTS.UploadMethod EQ "local") {
- // INVOKE MyUpload LOCAL
- MyUpload = MyUpload_init.CMYK_My_Upload_Local(AcceptedFileTypes="#ARGUMENTS.AcceptedFileTypes#",
- FileFieldName="#ARGUMENTS.FileFieldName#",DestinationPath="#ARGUMENTS.DestinationPath#",
- DestinationFolder="#ARGUMENTS.DestinationFolder#",NameConflict="#ARGUMENTS.NameConflict#",
- UploadMethod="#ARGUMENTS.UploadMethod#");
- }
- // LOGIC ::
- else {
- // SETUP FTP PARAMETERS
- FTPHost = "#APPLICATION.file_server#";
- FTPPort = #APPLICATION.file_server_port#;
- FTPUser = "#APPLICATION.file_server_user#";
- FTPPass = "#APPLICATION.file_server_pass#";
- FTPTransferMode = "Auto";
- FTPSecure = "Yes";
- FTPTimeout = 300;
- FTPLocalFile = "#ARGUMENTS.FTPLocalFile#";
- FTPLocalPath = "#ARGUMENTS,DestinationPath#/temp#";
- FTPDestinationPath = "DataVault/#DestinationFolder#";
- // INVOKE MyUpload FTP
- MyUpload = MyUpload_init.CMYK_My_Upload_FTP(FTPHost="#APPLICATION.file_server#",FTPPort="#APPLICATION.file_server_port#",
- FTPUser="#APPLICATION.file_server_user#",FTPPass="#APPLICATION.file_server_pass#",FTPTransferMode="Auto",
- FTPSecure="Yes",FTPTimeout="300",FTPLocalFile="#ARGUMENTS.FTPLocalFile#",
- FTPLocalPath="#ARGUMENTS,DestinationPath#/temp#",FTPDestinationPath = "DataVault/#DestinationFolder#");
- }
- </cfscript>
- <!--- CFRETURN :: :: Return the result to the calling script. --->
- <cfreturn MyUpload />
- </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement