# UploadObject

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Unknown

Source code: <https://github.com/FrendsPlatform/Frends.AmazonS3>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                                       | Description                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| SourceDirectory : `String`                 | <p>Source directory.</p><p><br>Default: <code>-</code><br>Example: <code>c:\temp, \network\folder</code></p>                                                                                                                                                                                                                                                             |
| FileMask : `String`                        | <p>Windows-style filemask. Empty field = all objects (<em>).</em></p><p><em>Only one object will be uploaded when using pre-signed URL. Consider using .zip (for example) when uploading multiple objects at the same time.</em></p><p><br><em>Default:</em><br>Example: <em><code>.</code></em><code> , ?</code><em><code>file.*, foo</code></em><code>*.txt</code></p> |
| TargetDirectory : `String`                 | <p>AWS S3 root directory. If the directory does not exist, it will be created.</p><p><br>Default: <code>-</code><br>Example: <code>directory/</code></p>                                                                                                                                                                                                                 |
| BucketName : `String`                      | <p>AWS S3 bucket's name.</p><p><br>Default: <code>-</code><br>Example: <code>Bucket</code></p>                                                                                                                                                                                                                                                                           |
| UploadFromCurrentDirectoryOnly : `Boolean` | <p>Set to true to upload object(s) from the current directory only.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                 |
| PreserveFolderStructure : `Boolean`        | <p>Set to true to create subdirectories to S3 bucket.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                               |
| DeleteSource : `Boolean`                   | <p>Delete local source object(s) after upload.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                      |
| {% endtab %}                               |                                                                                                                                                                                                                                                                                                                                                                          |

{% tab title="Parameter: Connection" %}

| Name                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| AuthenticationMethod : `AuthenticationMethod` | <p>Authentication method to use when connecting to AWS S3 bucket. Options are pre-signed URL, or AWS Access Key ID+AWS Secret Access Key.</p><p>Possible values:</p><ul><li><code>AwsCredentials</code>:</li></ul><p>Authentication method to use when connecting to AWS S3 bucket. Options are pre-signed URL, or AWS Access Key ID+AWS Secret Access Key.</p><ul><li><code>PreSignedUrl</code>:</li></ul><p>Authentication method to use when connecting to AWS S3 bucket. Options are pre-signed URL, or AWS Access Key ID+AWS Secret Access Key.</p><p><br>Default: <code>0</code><br>Example: <code>PreSignedURL</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 🗝PreSignedUrl : `String`                     | <p>A pre-signed URL allows you to grant temporary access to users who don't have permission to directly run AWS operations in your account.</p><p>Enabled when using PreSignedURL.</p><p><br>Default: <code>-</code><br>Example: <code>"<https://bucket.s3.region.amazonaws.com/object/file.txt?X-Amz-Expires=120X-Amz-Algorithm>...</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| UseMultipartUpload : `Boolean`                | <p>Use Multipart upload?</p><p>This is a method used to asynchronously initiate a multipart upload for a large object (file size over 5 GB) to Amazon S3.</p><p>Multipart upload breaks the object into smaller parts, which are uploaded independently in parallel.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 🗝AwsAccessKeyId : `String`                   | <p>AWS Access Key ID. Enabled when using AWSCredentials.</p><p><br>Default: <code>-</code><br>Example: <code>AKIAQWERTY7NJ5Q7NZ6Q</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 🗝AwsSecretAccessKey : `String`               | <p>AWS Secret Access Key. Enabled when using AWSCredentials.</p><p><br>Default: <code>-</code><br>Example: <code>TVh5hgd3uGY/2CqH+Kkrrg3dadbXLsYe0jC3h+WD</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Region : `Region`                             | <p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><p>Possible values:</p><ul><li><code>AfSouth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApEast1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApNortheast1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApNortheast2</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApNortheast3</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApSouth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApSoutheast1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>ApSoutheast2</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>CaCentral1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>CnNorth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>CnNorthWest1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuCentral1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuNorth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuSouth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuWest1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuWest2</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>EuWest3</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>MeSouth1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>SaEast1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>UsEast1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>UsEast2</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>UsWest1</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><ul><li><code>UsWest2</code>:</li></ul><p>AWS S3 bucket's region. Enabled when using AWSCredentials.</p><p><br>Default: <code>-</code><br>Example: <code>EuCentral1</code></p> |
| ReturnListOfObjectKeys : `Boolean`            | <p>Return object keys from S3 in prefix/filename-format. Enabled when using AWSCredentials.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Overwrite : `Boolean`                         | <p>Set to true to overwrite object(s) with the same path and name (object key). Enabled when using AWSCredentials.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| GatherDebugLog : `Boolean`                    | <p>Whether to gather AWS SDK debug log.</p><p>Please note that AWS SDK logging is not thread-safe and can pollute log output for tasks that run in parallel.</p><p>It is recommended to disable debug logging in production.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| PartSize : `Int64`                            | <p>Specifies the size (in MB) of individual parts into which large files are divided when Connection.UseMultipartUpload = true.</p><p>Each part is limited to a minimum of 5 MB and a maximum of 5 TB in Amazon S3.</p><p>Recommended part sizes typically range from 10 MB to 100 MB for optimal performance.</p><p><br>Default: <code>-</code><br>Example: <code>10</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| UseAcl : `Boolean`                            | <p>Enable/disable an AWS S3 access control list.</p><p>Not supported when using multipart upload (Connection.UseMultipartUpload = true).</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Acl : `ACLs`                                  | <p>Access control list. Enabled when UseACL is true.</p><p>Possible values:</p><ul><li><code>Private</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>PublicRead</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>PublicReadWrite</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>AuthenticatedRead</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>BucketOwnerRead</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>BucketOwnerFullControl</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><ul><li><code>LogDeliveryWrite</code>:</li></ul><p>Access control list. Enabled when UseACL is true.</p><p><br>Default: <code>-</code><br>Example: <code>Private</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| {% endtab %}                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

{% tab title="Parameter: Options" %}

| Name                             | Description                                                                                                                                      |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| ThrowErrorIfNoMatch : `Boolean`  | <p>Throw error if there are no object(s) in the path matching the filemask.</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p> |
| ThrowErrorOnFailure : `Boolean`  | <p>Throw error on failure.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                              |
| ErrorMessageOnFailure : `String` | <p>Error message to display on failure.</p><p><br>Default: <code>-</code><br>Example: <code>-</code></p>                                         |
| {% endtab %}                     |                                                                                                                                                  |

{% tab title="Result: Result" %}

| Name                     | Description                                                                                        |                          |      |                                                                                                  |
| ------------------------ | -------------------------------------------------------------------------------------------------- | ------------------------ | ---- | ------------------------------------------------------------------------------------------------ |
| Success : `Boolean`      | <p>Upload complete.<br>Example: <code>true</code></p>                                              |                          |      |                                                                                                  |
| Objects : `List<String>` | <p>Uploaded Object.<br>Example: <code>{C:\temp\ExampleFile.txt}, {temp\ExampleFile.txt}</code></p> |                          |      |                                                                                                  |
| DebugLog : `String`      | <p>Debug log of file upload.<br>Example: <code>EnvironmentVariableInternalConfiguration 1          | 2023-02-06T08:52:17.618Z | INFO | The environment variable AWS\_ENABLE\_ENDPOINT\_DISCOVERY was not set with a value...</code></p> |
| Error : `Error`          | Error information if upload failed.                                                                |                          |      |                                                                                                  |
| {% endtab %}             |                                                                                                    |                          |      |                                                                                                  |

{% tab title="Changelog" %}

## Changelog

### \[3.2.0] - 2025-12-29

#### Changed

* Updated AWS SDK version.

### \[3.1.0] - 2025-10-17

#### Fixed

* Fixed TargetDirectory to handle trailing slash.

### \[3.0.0] - 2025-07-23

* \[Breaking] Renamed `FilePath` to `SourceDirectory` in Input class for better clarity
* \[Breaking] Renamed `S3Directory` to `TargetDirectory` in Input class for consistency
* \[Breaking] Moved `BucketName` from Connection to Input class as it's essential for task function
* \[Breaking] Moved `UploadFromCurrentDirectoryOnly` from Connection to Input class
* \[Breaking] Moved `PreserveFolderStructure` from Connection to Input class
* \[Breaking] Moved `DeleteSource` from Connection to Input class
* \[Breaking] Renamed `AWSCredentials` to `AwsCredentials` in Connection class following PascalCase conventions
* \[Breaking] Renamed `PreSignedURL` to `PreSignedUrl` in Connection class following PascalCase conventions
* \[Breaking] Moved `PartSize` from Input to Connection class as it's connection-related
* \[Breaking] Moved and renamed `UseACL` to `UseAcl` in Connection class following PascalCase conventions
* \[Breaking] Moved and renamed `ACL` to `Acl` in Connection class following PascalCase conventions
* \[Breaking] Created new Options class with standard `ThrowErrorOnFailure` and `ErrorMessageOnFailure` properties
* \[Breaking] Moved `ThrowErrorIfNoMatch` from Connection to Options class
* \[Breaking] Renamed `UploadedObjects` to `Objects` in Result class for consistency
* \[Breaking] Task method signature now follows standard pattern: Input, Connection, Options parameters

### \[2.0.0] - 2025-05-21

#### Changed

* Updated AWS SDK to version 4.0.0.5
* Changed the logging logic to use custom logger

#### Added

* \[Breaking]Added GatherDebugLog option to allow disabling the DebugLog, `false` by default
  * By default, the gathering debug log is now disabled.
  * To replicate the previous task behaviour set GatherDebugLog parameter to `true`

### \[1.3.0] - 2025-03-13

#### Fixed

* Fixed issue where ThrowErrorIfNoMatch was not correctly handled. Now, no error is thrown if set to false, and an error is thrown if set to true when no files match."

### \[1.2.0] - 2023-08-02

#### Added

* Added multipart upload feature, which allows transferring files larger than 5GB.

### \[1.1.1] - 2023-06-13

#### Changed

* Connection.ThrowExceptionOnErrorResponse documentation update.
* Improved exception handling.

### \[1.1.0] - 2023-02-07

#### Changed

* Task returns an object instead of list.

#### Added

* Result.Success to indicate that operation was completed without errors.
* Result.DebugLog to contain log of each operation.
* Connection.ThrowExceptionOnErrorResponse to choose whether an error throws an exception or is logged to Result.DebugLog.

### \[1.0.0] - 2022-05-05

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
