Falcon
Yönetici
Kod:
using System;
using System.IO;
using System.Net;
class Program
{
static void Main()
{
string ftpHost = "ftp://example.com"; // FTP adresi (ftp:// ile başlar)
string ftpUsername = "kullaniciadi";
string ftpPassword = "sifre";
string localFilePath = @"C:\Dosyalar\ornek.txt"; // Yüklenecek dosyanın yolu
string remoteFileName = "ornek.txt"; // FTP sunucusunda kaydedilecek isim
string uploadUrl = $"{ftpHost}/{remoteFileName}";
try
{
// FTP isteği oluştur
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uploadUrl);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
// Dosya içeriğini oku
byte[] fileContents = File.ReadAllBytes(localFilePath);
request.ContentLength = fileContents.Length;
// Dosya verisini gönder
using (Stream requestStream = request.GetRequestStream())
{
reque