Posted on: 1/12/2014 11:37:18 AM | Views : 795

Need to upload the file, but not the one on which the application is spinning. As a result, it is impossible because the FileUpload does not give the entire path to the file that is trying to load
private void FTPUploadFile(string filename) { FileInfo fileInf = new FileInfo(filename);FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + "url/images" + "/" + fileInf.Name)); reqFTP.Credentials = new NetworkCredential("user", "pass"); reqFTP.KeepAlive = false; reqFTP.Method = WebRequestMethods.Ftp.UploadFile; reqFTP.UseBinary = true; reqFTP.ContentLength = fileInf.Length; int buffLength = 2048;
byte[] buff = new byte[buffLength]; int contentLen; FileStream fs = fileInf.OpenRead(); try { Stream strm = reqFTP.GetRequestStream(); contentLen = ...

Go to the complete details ...