Step 1: Add the below namesapce at the top of the code behind.
using System.Net; using System.Text.RegularExpressions; using System.IO;
Step 2: Add the following method which will upload the file.
public string UploadFile() { try { string filePath = Server.MapPath(@"FolderNamefile.jpg"); string FtpUrl = "ftp://ftp.domain.com/"; string userName = "ftp_user"; string password = "ftp_password"; string UploadDirectory = ""; string PureFileName = new FileInfo(filePath).Name; String uploadUrl = String.Format("{0}{1}/{2}", FtpUrl, UploadDirectory, PureFileName); FtpWebRequest req = (FtpWebRequest)FtpWebRequest.Create(uploadUrl); req.Proxy = null; req.Method = WebRequestMethods.Ftp.UploadFile; req.Credentials = new NetworkCredential(userName, password); req.UseBinary = true; req.UsePassive = true; byte[] data = File.ReadAllBytes(filePath); req.ContentLength = data.Length; Stream stream = req.GetRequestStream(); stream.Write(data, 0, data.Length); stream.Close(); FtpWebResponse res = (FtpWebResponse)req.GetResponse(); return res.StatusDescription; } catch (Exception ex) { return ""; } }
10 thoughts on - Upload file via FTP using asp.net c#
비아몰 정품 비아그라 구매 사이트 정품시알리스 약국판매
I came to this site with the introduction of a friend around me and I was very impressed when I found your writing. I’ll come back often after bookmarking! bitcoincasino
butun atrzta pornolari izleyebilirsiniz
海外 ラブドール ダッチワイフは、並外れた性的欲求を持つ男性にとって非常に重要な必要性です
sizde hemen online olarak https://steroidvip8.com/ steroid siparis verin
sitemizi ziyaret edin SEO Fiyatları ve hakkında bilgi alın.
무료 슬롯 게임
그는 Ouyang Zhi에 대해 매우 걱정하는 척하기 위해 최선을 다했습니다.
그린 벳 토토
다만 마차가 빠르기는 하지만 정말 불편하다.
lebensechte Sexpuppen https://de.yourdoll.com
Unleash your inner warrior in this RPG adventure Lucky Cola