Esporta (0) Stampa
Espandi tutto

Metodo CloudBlob.UploadFile (String, BlobRequestOptions)

Uploads a file from the file system to a block blob.

Spazio dei nomi: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in microsoft.windowsazure.storageclient.dll)

'Utilizzo
Dim instance As CloudBlob
Dim fileName As String
Dim options As BlobRequestOptions

instance.UploadFile(fileName, options)

public virtual void UploadFile (
	string fileName,
	BlobRequestOptions options
)
public void UploadFile (
	String fileName, 
	BlobRequestOptions options
)
public function UploadFile (
	fileName : String, 
	options : BlobRequestOptions
)

Parametri

fileName

The path and file name of the file to upload.

options

An object that specifies any additional options for the request.

The following code example uploads a file from the local computer to a blob.

static void UploadBlobFromFile(Uri blobEndpoint, string accountName, string accountKey)
{
    //Create service client for credentialed access to the Blob service.
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //Get a reference to a container, which may or may not exist.
    CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
            
    //Create a new container, if it does not exist
    container.CreateIfNotExist();

    //Get a reference to a blob, which may or may not exist.
    CloudBlob blob = container.GetBlobReference("myfile.txt");

    //Upload content to the blob, which will create the blob if it does not already exist.
    blob.UploadFile("c:\\myfile.txt");
}


Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme di sviluppo

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 e Windows 2000

Piattaforme di destinazione

Aggiunte alla community

Mostra:
© 2014 Microsoft