Share via


FtpClientConnection.SendFiles(String[], String, Boolean, Boolean) 方法

定义

将文件发送到文件传输协议 (FTP) 服务器。

public:
 void SendFiles(cli::array <System::String ^> ^ localFileNames, System::String ^ remotePath, bool overwrite, bool isTransferAscii);
public void SendFiles (string[] localFileNames, string remotePath, bool overwrite, bool isTransferAscii);
member this.SendFiles : string[] * string * bool * bool -> unit
Public Sub SendFiles (localFileNames As String(), remotePath As String, overwrite As Boolean, isTransferAscii As Boolean)

参数

localFileNames
String[]

FTP 服务器上要发送的文件。

remotePath
String

在其中查找文件的远程路径。

overwrite
Boolean

指定是否覆盖远程计算机上已存在的文件。 true 值指示任务将覆盖现有文件。

isTransferAscii
Boolean

指定是否应在 ASCII 模式下发送文件。 true 值指示应在 ASCII 模式下发送文件。

示例

下面的代码示例说明如何使用 SendFiles 方法。

Package pkg = new Package();  
Connections conns = pkg.Connections;  
ConnectionManager cm = conns.Add("FTP");  
//...  
FtpClientConnection myftpClientConn = new FtpClientConnection(cm);  
String[] localFileNames = { "myTestFile", "myFTPFile" };  
String remotePath = @"\\myserver\myFolder";  
myftpClientConn.SendFiles(localFileNames, remotePath, true, false);  
Dim pkg As New Package()  
Dim conns As Connections = pkg.Connections  
Dim cm As ConnectionManager = conns.Add("FTP")  
'...  
Dim myftpClientConn As New FtpClientConnection(cm)  
Dim localFileNames() As String = {"myTestFile", "myFTPFile"}  
Dim remotePath As String = "\\myserver\myFolder"  
myftpClientConn.SendFiles(localFileNames, remotePath, True, False)  

适用于