Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!--- CFFUNCTION ::  --->
  2. <cffunction name="CMYK_My_Upload_MultiMethod" access="public" returnType="struct"
  3.     hint="Handles the upload functions for local CFFILE method of uploading.">
  4.  
  5.     <!--- CFARGUMENT :: AcceptedFileTypes --->
  6.     <cfargument name="AcceptedFileTypes" type="String" required="No" hint="The type of files accepted.  Example: image/jpg,image/jpeg" default="Any" />
  7.     <cfargument name="FileFieldName" type="String" required="No" hint="The name used for the form field to process.  Example: FORM.Portfolio_Avatar" default="" />
  8.     <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" />
  9.     <cfargument name="DestinationFolder" type="String" required="Yes" hint="The folder where the file is stored." default="temp" />
  10.     <cfargument name="NameConflict" type="String" required="No" hint=" Options: makeunique, rename, overwrite, skip" default="makeunique" />
  11.     <cfargument name="UploadMethod" type="String" required="Yes" hint=" Options: local, ftp" default="local" />
  12.     <cfargument name="FTPLocalFile" type="String" required="No" hint="Pass the filename if FTP method" default="" />
  13.  
  14.  
  15. <!--- CFSCRIPT ::  Call the appropriate CFC --->
  16. <cfscript>
  17.  
  18. // INVOKE CMYK_My_Upload_Local [ Initialize CFC ]
  19.     MyUpload_init = createObject("component","cfc_cmyk_upload.cfc");
  20.  
  21.   // LOGIC :: LOGIC :: If the defined method is assigned for local uploads...
  22.     if (ARGUMENTS.UploadMethod EQ "local") {
  23.  
  24.         // INVOKE MyUpload LOCAL
  25.         MyUpload = MyUpload_init.CMYK_My_Upload_Local(AcceptedFileTypes="#ARGUMENTS.AcceptedFileTypes#",
  26.         FileFieldName="#ARGUMENTS.FileFieldName#",DestinationPath="#ARGUMENTS.DestinationPath#",
  27.         DestinationFolder="#ARGUMENTS.DestinationFolder#",NameConflict="#ARGUMENTS.NameConflict#",
  28.         UploadMethod="#ARGUMENTS.UploadMethod#");
  29.  
  30.  
  31.     }
  32.  
  33.    // LOGIC ::
  34.     else {
  35.  
  36.         // SETUP FTP PARAMETERS
  37.         FTPHost = "#APPLICATION.file_server#";
  38.         FTPPort = #APPLICATION.file_server_port#;
  39.         FTPUser = "#APPLICATION.file_server_user#";
  40.         FTPPass = "#APPLICATION.file_server_pass#";
  41.         FTPTransferMode = "Auto";
  42.         FTPSecure = "Yes";
  43.         FTPTimeout = 300;
  44.         FTPLocalFile = "#ARGUMENTS.FTPLocalFile#";
  45.         FTPLocalPath = "#ARGUMENTS,DestinationPath#/temp#";
  46.         FTPDestinationPath = "DataVault/#DestinationFolder#";
  47.  
  48.  
  49.  
  50.         // INVOKE MyUpload FTP
  51.         MyUpload = MyUpload_init.CMYK_My_Upload_FTP(FTPHost="#APPLICATION.file_server#",FTPPort="#APPLICATION.file_server_port#",
  52.         FTPUser="#APPLICATION.file_server_user#",FTPPass="#APPLICATION.file_server_pass#",FTPTransferMode="Auto",
  53.         FTPSecure="Yes",FTPTimeout="300",FTPLocalFile="#ARGUMENTS.FTPLocalFile#",
  54.         FTPLocalPath="#ARGUMENTS,DestinationPath#/temp#",FTPDestinationPath = "DataVault/#DestinationFolder#");
  55.  
  56.  
  57.     }
  58.  
  59. </cfscript>
  60.  
  61.  
  62.  
  63.          <!--- CFRETURN ::  :: Return the result to the calling script. --->
  64.          <cfreturn MyUpload />
  65.  
  66.  
  67.  
  68.  
  69. </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement