Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string _cds_stb = _cdn_stb.ToString("0000");
- string ftpUser = "sasasas";
- string ftpPassword = "sasasas";
- string ftpfullpath = "ftp://www.meusite.com.br/wordpress/imagens/" + _cds_stb + "/" + _imb_prt_mnu; ;
- FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpfullpath));
- //userid and password for the ftp server
- ftp.Credentials = new NetworkCredential(ftpUser, ftpPassword);
- ftp.KeepAlive = true;
- ftp.UseBinary = true;
- ftp.UsePassive = true;
- ftp.Method = WebRequestMethods.Ftp.UploadFile;
- ftp.ContentLength = picture.Length;
- Stream ftpstream = ftp.GetRequestStream();
- var grava = new Task(() =>
- {
- ftpstream.Write(picture, 0, picture.Length);
- });
- grava.Start();
- grava.Wait(TimeSpan.FromSeconds(10));
- ftpstream.Close();
- }
Add Comment
Please, Sign In to add comment