Differences

This shows you the differences between the selected revisions of the page.

library_session_putfiletodirectory 2019-09-26 library_session_putfiletodirectory 2024-01-05 (current)
Line 3: Line 3:
This is a convenient alternative to [[library_session_putfiles|''Session.PutFiles'']], when you want to upload only one specific file to a specific remote directory, keeping its original name. This is a convenient alternative to [[library_session_putfiles|''Session.PutFiles'']], when you want to upload only one specific file to a specific remote directory, keeping its original name.
- 
-&beta_feature 
===== Syntax ===== ===== Syntax =====
<code csharp *> <code csharp *>
-public TransferOperationResult PutFileToDirectory(+public TransferEventArgs PutFileToDirectory(
    string localFilePath,     string localFilePath,
    string remoteDirectory,     string remoteDirectory,
Line 22: Line 20:
    Optional remove As Boolean = False,     Optional remove As Boolean = False,
    Optional options As TransferOptions = Nothing     Optional options As TransferOptions = Nothing
-) As TransferOperationResult+) As TransferEventArgs
</code> </code>
==== Parameters ==== ==== Parameters ====
^ Name ^ Description ^ ^ Name ^ Description ^
-| string ==localFilePath== | Full path to the remote file to upload. |+| string ==localFilePath== | Full path to the local file to upload. |
| string ==remoteDirectory == | Full path to the remote directory to upload the file to. | | string ==remoteDirectory == | Full path to the remote directory to upload the file to. |
| bool ==remove== | When set to ''true'', deletes the source local file(s) after a successful transfer. Defaults to ''false''. | | bool ==remove== | When set to ''true'', deletes the source local file(s) after a successful transfer. Defaults to ''false''. |
Line 33: Line 31:
==== Return Value ==== ==== Return Value ====
-''[[library_transferoperationresult|TransferOperationResult]]''.+''[[library_transfereventargs|TransferEventArgs]]''.
===== Exceptions ===== ===== Exceptions =====
Line 43: Line 41:
| TimeoutException | Timeout waiting for ''winscp.com'' to respond. | | TimeoutException | Timeout waiting for ''winscp.com'' to respond. |
-===== Remarks ===== +===== [[remarks]] Remarks ===== 
-Event ''[[library_session_filetransferred|Session.FileTransferred]]'' is raised.+Event ''[[library_session_filetransferred|Session.FileTransferred]]'' is raised. Also raises [[library_session_filetransferprogress|''Session.FileTransferProgress'']] throughout the transfer.
Contrary to [[library_session_putfiles|''Session.PutFiles'']]: Contrary to [[library_session_putfiles|''Session.PutFiles'']]:
-  * You specify a path to the source file, not a [[library_wildcard|wildcard]], so you do not need to escape a literal file name. 
  * You do not specify a target name (or an operation mask) in the destination path (original names are preserved when uploading).   * You do not specify a target name (or an operation mask) in the destination path (original names are preserved when uploading).
  * You do not need to make sure that the target directory path ends with a slash.   * You do not need to make sure that the target directory path ends with a slash.
-  * The method upload files only. It throws when the source path points to a directory.+  * The method uploads files only. It throws when the source path points to a directory.
  * The method throws an exception on error automatically. No need to [[library_session#results|call ''OperationResultBase.Check'']].   * The method throws an exception on error automatically. No need to [[library_session#results|call ''OperationResultBase.Check'']].
 +
 +===== Example =====
 +
 +==== Real-Life Examples ====
 +
 +  * [[library_example_zip_and_upload|*]].

Last modified: by martin