• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1980
  • Last Modified:

How to Program CuteFTP 8 File Transfers

I am using the CuteFTP Pro 8 interface to manually transfer files from my local directory to a remote site that I have permissions for.

Can this be done programatically?

Could you give me references?

Thanks,
0
Dovberman
Asked:
Dovberman
  • 6
5 Solutions
 
botwebCommented:
You need to write a Visual Basic Script as described in the docs http://help.globalscape.com/help/cuteftppro8/index.htm#About_the_Transfer_Engine.htm
0
 
DovbermanAuthor Commented:
It will take a while to learn how to use the transfer engine.

For a given example:

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Protocol = "FTPS_IMPLICIT "

MySite.Host = "ftp.ftp.net" >

MySite.Port = 990

MySite.Login = "username"

MySite.Password = "password"

MySite.Connect

Can C# be used?

Can this be placed in the code behind file?
0
 
DovbermanAuthor Commented:
I called CuteFTP support.  Use of the transfer engine and coding is not supported in Windows 7.

What other FTP client software is available that can be programatically controlled?

Thanks,
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
DovbermanAuthor Commented:
Here is how it is done using Code Behind:


protected void cmdUploadFiles_Click(object sender, EventArgs e)
    // Upload files from the local machine to the FTP Site

    // Get the object used to communicate with the server.
    {
        FtpWebRequest UploadRequest;
        StreamWriter UploadStreamWriter;
        //StreamReader UploadStreamReader;
        string strUriTarget = "ftp://ftp.StockPickerMax.com/Data/";

        // Get source and destination file names
        string[] strFileTarget;
        string[] strArrayTarget = new string[3];
        strArrayTarget[0] = strUriTarget + "AMEX.txt";
        strArrayTarget[1] = strUriTarget + "NASDAQ.txt";
        strArrayTarget[2] = strUriTarget + "NYSE.txt";

        string[] strFileName;
        string[] strArraySource = new string[3];
        strArraySource[0] = "AMEX.txt";
        strArraySource[1] = "NASDAQ.txt";
        strArraySource[2] = "NYSE.txt";

        string strSourceBase = "C:\\Develop\\Apps\\StockPro\\";
        string strSourcePath = strSourceBase + "Data\\";

        string strResponse = "";
        string strSourceFile = "";
    
        // Transfer files
        for (int intCtr = 0; intCtr <= 2; intCtr++)
        {
            Uri UriFileTarget = new Uri(strArrayTarget[intCtr]); //Uri("ftp://ftp.StockPickerMax.com/Data/AMEX.txt");
            UploadRequest = (FtpWebRequest)WebRequest.Create(UriFileTarget);
            UploadRequest.Credentials = new NetworkCredential("MyUserName", "MyPassword");
            UploadRequest.UseBinary = true;
            UploadRequest.Method = WebRequestMethods.Ftp.UploadFile;
            
            // Copy the contents of the file to the request stream.
          
            strSourceFile = strSourcePath + strArraySource[intCtr];

            StreamReader SourceStream = new StreamReader(strSourceFile);
            byte[] fileContents = Encoding.UTF8.GetBytes(SourceStream.ReadToEnd());
            SourceStream.Close();
            UploadRequest.ContentLength = fileContents.Length;
            Stream RequestStream = UploadRequest.GetRequestStream();
            RequestStream.Write(fileContents, 0, fileContents.Length);
            RequestStream.Close();

            FtpWebResponse UploadResponse = (FtpWebResponse)UploadRequest.GetResponse();
            strResponse = UploadResponse.StatusDescription.ToString();
        }

Open in new window

0
 
DovbermanAuthor Commented:
I solved it myself
0
 
DovbermanAuthor Commented:
I solved it yself
0
 
DovbermanAuthor Commented:
Please close this question.  I do not care who gets the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now