【发布时间】:2023-04-06 18:45:02
【问题描述】:
我想在我的 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 = files 和 uplFileUpload.FileName = test.txt
现在我将连接它们并上传到 blob.. 但是效果不好。。 我越来越 https://test.core.windows.net/documents/files/
我没有得到全部 我期待https://test.core.windows.net/documents/files/test.txt
我做错了什么... 如何在 blob 中创建子目录。
【问题讨论】:
标签: windows azure blob directory