4 Replies Latest reply on Dec 12, 2006 1:03 PM by CtrlShiftF11

    Automatically Upload client file to CF Server

    CtrlShiftF11
      I have a scenario where I need to automatically upload a client file to CF Server without using a browser. WebDAV redirector will not do this as I am using https. I've written a simple ColdFusion web service to handle the file once I get it but I have no idea how to consume this service from the client without a user openning a browser. Here's my simple web service code...

      <cfcomponent>
      <cffunction name="uploadFile" access="remote" returntype="void" hint="Web Service to process secure file upload">
      <cfargument name="appUserID" type="string" required="yes">
      <cfargument name="appPassword" type="string" required="yes">
      <cfargument name="uploadFile" type="binary" required="yes">
      <cfargument name="workgroupID" type="string" required="yes">
      <cfset uploadDir = #APPLICATION.defaultRootValue# & "/filestores/groups/" & #workgroupID# & "/">
      <cffile action="upload" filefield="#uploadFile#" destination="#uploadDir#">
      </cffunction>
      </cfcomponent>
        • 1. Re: Automatically Upload client file to CF Server
          Level 7
          You will have to use SOMETHING that will post the file. One example,
          using CF would be to use <cfhttp>. This template then could be tiggered
          by some other process, such as a scheduled task, to run when desired.

          <cfhttp url="a.web.site/fileAccept.cfc" ...>
          <cfhttpparam name="theFile" value="file"...>
          ....

          • 2. Re: Automatically Upload client file to CF Server
            CtrlShiftF11 Level 1
            Thanks for the reply but it is important to note that the process will not be initiated from a CF Server. A Client machine will have a file that it needs to automatically upload to my CF Server. The Web Service code can put that file where it needs to go, but I have no idea what to do on the client side to send that file to the ColdFusion Web Service. I can't use a browser, this has to be ran by a task on the client, no end user action required.
            • 3. Re: Automatically Upload client file to CF Server
              Level 7
              Thanks for the reply but it is important to note that the process will
              not be initiated from a CF Server.

              I understood that. But SOMETHING needs to be running on the client.
              Pick your poison in what this something is written in. C++, VB, Java,
              Fortran, Cobol, whatever. This something will then get a file and
              submit it to a URL.
              • 4. Re: Automatically Upload client file to CF Server
                CtrlShiftF11 Level 1
                I found a solution - and yes the best things in life are free! You should check out a tool called curl.
                http://curl.haxx.se/

                curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks. Text curl