empty image from blob storage

前端 未结 1 1890
萌比男神i
萌比男神i 2021-01-25 03:12

This is how I try to upload an image to Azure blog storage, then upload an empty file located there.

\"Azure

1条回答
  •  无人共我
    2021-01-25 03:50

    As Marco said, FileMode.Create specifies that the operating system should create a new file. If the file already exists, it will be overwritten. For more details, you could refer to this article.

    According to the pictures you provided, your blob size is 0 B. So, you would always couldn't find the file and open it. FileMode specifies how the operating system should open a file.

    So I suggest that you could delete it and use OpenRead to open an existing file for reading. You could refer to the code as below:

    using (var f = System.IO.File.OpenRead(model.FileToUpload.FileName))
                {
                    await blockBlob.UploadFromStreamAsync(f);
                }
    

    0 讨论(0)
提交回复
热议问题