共用方式為


IFileSystemOperations.UploadFile Method

Definition

Uploads a file to the specified Data Lake Store account.

public void UploadFile (string accountName, string sourcePath, string destinationPath, int threadCount = -1, bool resume = false, bool overwrite = false, bool uploadAsBinary = false, IProgress<Microsoft.Azure.Management.DataLake.Store.TransferProgress> progressTracker = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFile : string * string * string * int * bool * bool * bool * IProgress<Microsoft.Azure.Management.DataLake.Store.TransferProgress> * System.Threading.CancellationToken -> unit
Public Sub UploadFile (accountName As String, sourcePath As String, destinationPath As String, Optional threadCount As Integer = -1, Optional resume As Boolean = false, Optional overwrite As Boolean = false, Optional uploadAsBinary As Boolean = false, Optional progressTracker As IProgress(Of TransferProgress) = Nothing, Optional cancellationToken As CancellationToken = Nothing)

Parameters

accountName
String

The Azure Data Lake Store account to execute filesystem operations on.

sourcePath
String

The local source file to upload to the Data Lake Store account.

destinationPath
String

The Data Lake Store path (starting with '/') of the directory or directory and filename to upload to.

threadCount
Int32

The maximum number of threads to use during the upload. By default, this number will be computed based on file size.

resume
Boolean

A switch indicating if this upload is a continuation of a previous, failed upload. Default is false.

overwrite
Boolean

A switch indicating this upload should overwrite the target file if it exists. Default is false, and the upload will fast fail if the target file exists.

uploadAsBinary
Boolean

A switch indicating this upload should treat the file as binary, which is slightly more performant but does not ensure record boundary integrity.

progressTracker
IProgress<TransferProgress>

An optional delegate that can be used to track the progress of the upload operation asynchronously.

cancellationToken
CancellationToken

The cancellation token.

Exceptions

Thrown when the operation returned an invalid status code.

Thrown when the operation takes too long to complete or if the user explicitly cancels it.

Thrown when resume metadata is corrupt or not associated with the current operation.

Thrown when the source path cannot be found.

Thrown if an invalid upload is attempted or the file is modified externally during the operation.

Microsoft.Azure.Management.DataLake.Store.TransferFailedException

Thrown if the transfer operation fails.

Thrown when unable to deserialize the response

Thrown when a required parameter is null

Applies to