Dela via


BackgroundUploader.CreateUpload(Uri, IStorageFile) Method

Definition

Initializes an UploadOperation that indicates the location for and file for upload.

public:
 virtual UploadOperation ^ CreateUpload(Uri ^ uri, IStorageFile ^ sourceFile) = CreateUpload;
UploadOperation CreateUpload(Uri const& uri, IStorageFile const& sourceFile);
public UploadOperation CreateUpload(System.Uri uri, IStorageFile sourceFile);
function createUpload(uri, sourceFile)
Public Function CreateUpload (uri As Uri, sourceFile As IStorageFile) As UploadOperation

Parameters

uri
Uri Uri

The location for the upload.

sourceFile
IStorageFile

The file for upload.

Returns

The resultant upload operation.

Remarks

Important

Creating a large number of transfers on the main UI thread with CreateUpload can result in degraded performance of your app's UI. If you are queuing up a large number of transfers, it is recommended that you call CreateUpload on a background worker thread as in the following example.

operation = await Task.Run(() => { return myDownloader.CreateUpload(uri, file); });

Applies to

See also