相关疑难解决方法(0)

将文件上传到azure blob存储,然后使用文件base64字符串发送http响应不起作用

我试图使用azures blob存储实现以下功能.

  1. 将文件上传到azure blob存储.
  2. 然后发送包含该文件的base64字符串的http响应.

奇怪的是,我只能使用一个工作,因为它会导致另一个工作,这取决于我的代码的顺序.

        HttpPostedFile image = Request.Files["froalaImage"];
        if (image != null)
        {
            string fileName = RandomString() + System.IO.Path.GetExtension(image.FileName);
            string companyID = Request.Form["companyID"].ToLower();

            // Retrieve storage account from connection string.
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create the blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve reference to a previously created container.
            CloudBlobContainer container = blobClient.GetContainerReference(companyID);

            // Create the container if it doesn't already exist.
            container.CreateIfNotExists();

            // Retrieve reference to a blob named "filename".
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName); …
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-storage-blobs

1
推荐指数
1
解决办法
596
查看次数

标签 统计

.net ×1

azure ×1

azure-storage-blobs ×1

c# ×1