导出 (0) 打印
全部展开
此主题尚未评级 - 评价此主题

CloudBlob.UploadFile 方法 (String, BlobRequestOptions)

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

命名空间: Microsoft.WindowsAzure.StorageClient
程序集: Microsoft.WindowsAzure.StorageClient(在 microsoft.windowsazure.storageclient.dll 中)
用法
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
)

参数

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");
}


此类型的任何公共静态(在 Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目标平台

本文是否对您有所帮助?
(1500 个剩余字符)
感谢您的反馈

社区附加资源

显示:
© 2014 Microsoft. 版权所有。