将所有文件从本地存储上传到Azure Blob存储 [英] Upload all files from local storage to Azure Blob Storage

查看:294
本文介绍了将所有文件从本地存储上传到Azure Blob存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在努力将多个文件从本地存储上传到Azure Blob存储,我想知道是否有人可以帮助我,以下是我以前用来上传单个zip文件的代码.

I am currently struggling to upload multiple files from the local storage to the Azure Blob Storage, I was wondering if anyone could help me, below is the code i was previously using to upload a single zip file.

    private void SaveZip(string id, string fileName, string contentType, byte[] data)
    {
        // Create a blob in container and upload image bytes to it
        var blob = this.GetContainer().GetBlobReference(fileName);

        blob.Properties.ContentType = contentType;

        // Create some metadata for this image
        var metadata = new NameValueCollection();
        metadata["Id"] = id;
        metadata["Filename"] = fileName;
    }

    SaveZip(
        Guid.NewGuid().ToString(),
        zipFile.FileName,
        zipFile.PostedFile.ContentType,
        zipFile.FileBytes);

谢谢,萨米.

推荐答案

我认为没有可用于将多个文件上传到BLOB的内置方法.您可以做的是一张一张地上传,也可以平行上传.

I don't think there's any build-in methods you can use to upload multiple files to the BLOB. What you can do is to upload them one by one, or parallel.

这篇关于将所有文件从本地存储上传到Azure Blob存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆