gpt4 book ai didi

Windows Azure : Creating a subdirectories inside the blob

转载 作者:行者123 更新时间:2023-12-03 01:58:35 25 4
gpt4 key购买 nike

我想在我的 blob 中创建一些子目录。但效果并不好

这是我的代码

protected void ButUpload_click(object sender, EventArgs e)
{
// store upladed file as a blob storage
if (uplFileUpload.HasFile)
{
name = uplFileUpload.FileName;
// get refernce to the cloud blob container
CloudBlobContainer blobContainer = cloudBlobClient.GetContainerReference("documents");

if (textbox.Text != "")
{
name = textbox.Text + "/" + name;
}
// set the name for the uploading files
string UploadDocName = name;

// get the blob reference and set the metadata properties
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(UploadDocName);
blob.Metadata["FILETYPE"] = "text";
blob.Properties.ContentType = uplFileUpload.PostedFile.ContentType;

// upload the blob to the storage
blob.UploadFromStream(uplFileUpload.FileContent);

}
}

我所做的是,如果我必须创建子目录,我将在文本框中输入子目录的名称。

例如,如果我需要在子目录“files”内创建一个名为“test.txt”的文件然后,my textbox.text = filesuplFileUpload.FileName = test.txt

现在我将连接它们并上传到 blob..但效果不太好..我刚刚 https://test.core.windows.net/documents/files/

我没有得到全部内容我在期待 https://test.core.windows.net/documents/files/test.txt

我做错了什么...如何在 blob 内创建子目录。

最佳答案

您可以使用 blobContainer.ListBlobs(new BlobRequestOptions { UseFlatBlobListing = true });获取您正在寻找的 View (忽略斜杠并仅列出所有 blob)。

关于Windows Azure : Creating a subdirectories inside the blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2618207/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com