コード例 #1
0
ファイル: FileWriter.cs プロジェクト: tumGER/Quasar
        public override bool SendFile(string SourceFilePath, string FilePath)
        {
            BVM.SetSize(String.Format("Current File Size : {0}", WriterOperations.BytesToString(new FileInfo(SourceFilePath).Length)));
            Log.Debug(String.Format("Updating File {0} - {1}", SourceFilePath, FilePath));
            FtpStatus Status = Client.UploadFile(SourceFilePath, FilePath, FtpRemoteExists.Overwrite, true, FtpVerify.None, Progress);

            return(Status.IsSuccess());
        }
コード例 #2
0
        public bool Upload(String localPath, String remotePath)
        {
            if (client == null)
            {
                return(false);
            }
            FtpStatus status = client.UploadFile(localPath, remotePath, FtpRemoteExists.Overwrite, true, FtpVerify.None);

            if (status.IsFailure())
            {
            }

            return(status.IsSuccess());
        }
コード例 #3
0
ファイル: FtpTests.cs プロジェクト: habibsql/TheNugetPackages
        public async Task ShouldUploadFileToFtpServerPath()
        {
            var ftpClient = new FtpClient("127.0.0.1", "guest", "guest");

            var profile = new FtpProfile();

            profile.Host          = "127.0.0.1";
            profile.RetryAttempts = 3;

            string fileTobeUploaded = @"myDirectory/2.jpg";

            var fileInfo = new FileInfo(fileTobeUploaded);

            using FileStream fileStream = fileInfo.OpenRead();

            FtpStatus ftpStatus = await ftpClient.UploadAsync(fileStream, "/myremotpath/");

            Assert.True(ftpStatus.IsSuccess());
        }