无法将Excel文件上传到Azure存储Blob

时间:2020-10-16 14:40:43

标签: c# .net azure azure-web-app-service azure-storage-blobs

我正在尝试将Excel文件上传到Azure存储容器中,但无法这样做。而不是上传excel文件,而是上传容器名称本身。我尝试过下面的代码。请帮忙。

from django.db import models
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import AbstractUser

# Create your models here.
class usermodel(AbstractUser):
    email = models.EmailField(max_length=60)
    username = models.CharField(max_length=20, unique=True)
    password = models.CharField(max_length=20)
    
    def __str__(self):
        return self.username

PFB屏幕截图而不是Mapper.xlsx excel文件,而是显示inputExcel(容器名称)

enter image description here

1 个答案:

答案 0 :(得分:3)

获取BlobClient时,您可以指定Blob的名称。您正在做:

BlobClient blob = blobContainer.GetBlobClient(destContainer);

因此blob以destContainer的值命名。

您可能希望这样做:

BlobClient blob = blobContainer.GetBlobClient("Mapper.xlsx");

这会将名为“ Mapper.xlsx”的blob放入以destContainer的值命名的容器中。