Toggle navigation
Images.Elk.pl
Upload a File
Directive Needed:
using System.Net;
Code:
private void uploadFile(string FTPAddress)
{
string filePath = ".\\" + txtLogin.Text + ".txt";
string username = "unban";
string password = "olnedban";
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(FTPAddress + "/MiST/users/" + Path.GetFileName(filePath));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(username, password);
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = false;
FileStream stream = File.OpenRead(filePath);
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Close();
Stream reqStream = request.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
}
Wyszukiwarka
Podobne podstrony:
function move uploaded file
move uploaded file
function is uploaded file
features file upload put method
features file upload common pitfalls
file upload
features file upload
fileman file upload
features file upload
features file upload put method
features file upload errors
features file upload
features file upload common pitfalls
features file upload put method
więcej podobnych podstron