Wednesday, August 14, 2013

Upload file into FTP

this is example code for upload file into FTP site.

 using (WebClient client = new WebClient())
            {
                byte[] ByteStream = ConvertFileIntoBtes("c:\\test.jpg");

                if (ByteStream != null)
                {
                    client.Credentials = new System.Net.NetworkCredential(USERNAME, PASSWORD);
                    client.UploadData(FTPSERVER + "/test.jpg", "STOR", ByteStream);
                }
            }

0 comments: