cURL / Mailing Lists / curl-library / Single Mail


Problem in FTP using c# in cURL

From: Amit Kumar Chugh <>
Date: Thu, 19 May 2005 10:32:10 +0530

Hi To All,


I have used this code to send a file to FTP server .every thing is going
fine..but it reads the file byte by it place the file on FTP serer
and give it a name as (nil) ....Now that's my problem .pls tell how can this
file be save by the same name as it's on client machine....


It's my source code..


string file=appPath ()+"test.txt";

                  //string FTP="";

                  string FTP="";

                  string User="Anonymous";

                  string Pass="";

                  MessageBox .Show (file);







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

                        Easy easy = new Easy();


                        Easy.ReadFunction rf = new



                        // new Easy.ReadFunction(OnReadData);

                        easy.SetOpt(CURLoption.CURLOPT_READFUNCTION, rf);

                        easy.SetOpt(CURLoption.CURLOPT_READDATA, fs);

                        //easy.SetOpt (CURLoption.CURLOPT_WRITEDATA ,

                        Easy.DebugFunction df = new

                        easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);

                        easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);


                        Easy.ProgressFunction pf = new



                        easy.SetOpt(CURLoption.CURLOPT_URL, FTP);


                              User + ":" + Pass);

                        easy.SetOpt(CURLoption.CURLOPT_UPLOAD, true);


                        //easy.SetOpt (CURLoption.CURLOPT_WRITEINFO

                        //easy.SetOpt (CURLoption.CURLOPT_WRITEDATA

                        //easy.SetOpt (CURLoption.CURLOPT_WRITEFUNCTION

















                        MessageBox .Show ("Done");


                  catch(Exception ex)


                        MessageBox .Show ("Error Occurs"+ex);




            public static Int32 OnReadData(Byte[] buf, Int32 size, Int32

                  Object extraData)


                  FileStream fs = (FileStream)extraData;

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




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


                  MessageBox .Show (msg);




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


                  MessageBox.Show (dlTotal.ToString () + dlNow.ToString () +
ulTotal.ToString () + ulNow.ToString ());

                  return 0; // standard return from PROGRESSFUNCTION





Thanks in Advance..

Pls reply to



Received on 2005-05-19