curl-library
RE: Regarding SFTP
Date: Thu, 27 Mar 2008 10:21:06 +0530
Hi Daniel, it's working fine. Now I'm able to upload the file to Secured FTP
server.
Thanks for the Info which u have provided.
Regards,
Ram.
_____
From: ramachandra.o_at_maple-software.com
[mailto:ramachandra.o_at_maple-software.com]
Sent: Wednesday, March 26, 2008 5:30 PM
To: 'curl-library_at_cool.haxx.se'
Subject: Regarding SFTP
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-27