FtpHelperUpload Method

上傳檔案

Definition

Namespace: eBizprise.Framework.FtpHelper
Assembly: eBizprise.Framework.FtpHelper (in eBizprise.Framework.FtpHelper.dll) Version: 25.0.3.0+adf38c4ccb2bf98d8ad258a6278302b5e05a94ed
C#
public ApiResult Upload(
	string fileName,
	byte[] fileContents
)

Parameters

fileName  String
檔案名
fileContents  Byte
資料

Return Value

ApiResult
ApiResult

Example

C#
string FileName = TargetFile;
using Stream fileStream = File.OpenRead(TargetPath + FileName);
Assert.IsNotNull(fileStream.Position, "讀取檔案失敗");
byte[] bytes = new byte[fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
ApiResult result = new FtpHelper().Upload(FileName, bytes);
Assert.IsTrue(result.IsSuccess, "上傳失敗");

Revision History

DateVersionDescription
2021/06/081.0.0.0初版
2021/07/211.0.1.0調整連接埠設定資料類型為int
2025/09/1925.0.0.0彙整2025年度初版
2025/11/2425.0.2.0調整設定值可由設定檔取得或自訂
2025/11/2725.0.3.0改用FluentFTP重構,移除已過時的FtpWebRequest

See Also