cURL / Mailing Lists / curl-library / Single Mail

curl-library

Regarding SFTP

From: <ramachandra.o_at_maple-software.com>
Date: Wed, 26 Mar 2008 17:30:00 +0530

Hi, thanks for the reply.

 

The version which I'm using is "libcurl.dll version--> 7.13.0.0".

 

The code which I used to upload the file (filename--> "Temp.zip")

 

 

 

Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

FileStream fs = new FileStream(filename, FileMode.Open,FileAccess.Read,
FileShare.Read);

 

Easy easy = new Easy();

 

easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYHOST, 0);

easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYPEER, 0);

 

Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);

easy.SetOpt(CURLoption.CURLOPT_READFUNCTION, rf);

easy.SetOpt(CURLoption.CURLOPT_READDATA, fs);

 

 

Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);

easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);

easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

 

 

Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);

easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

 

easy.SetOpt(CURLoption.CURLOPT_URL, "ftps://somenumber");

easy.SetOpt(CURLoption.CURLOPT_USERPWD, "userid" + ":" + "password");

easy.SetOpt(CURLoption.CURLOPT_UPLOAD, true);

easy.SetOpt(CURLoption.CURLOPT_INFILESIZE, fs.Length);

 

 

easy.Perform();

easy.Cleanup();

fs.Close();

Curl.GlobalCleanup();

 

 

 

public static Int32 OnReadData(Byte[] buf, Int32 size, Int32 nmemb,Object
extraData)

{

 FileStream fs = (FileStream)extraData;

 return fs.Read(buf, 0, size * nmemb);

}

 

public static void OnDebug(CURLINFOTYPE infoType, String msg,Object
extraData)

        {

            str += msg;

        }

public static Int32 OnProgress(Object extraData, Double dlTotal,Double
dlNow, Double ulTotal, Double ulNow)

        {

            return 0; // standard return from PROGRESSFUNCTION

        }

 

 
Received on 2008-03-26