Hello
I have this code to upload, and get the URL, but I cannot get URL
private async void SaveAction() {
//Upload to Azure, with a unique name, and get the location
var LocalFolder = FileSystem.AppDataDirectory;
var FilePath = Path.Combine(LocalFolder, $"{Note.Name}.rtf");
var FileName = Path.GetFileName(FilePath);
using (StreamWriter sw = new StreamWriter(FilePath)) {
sw.WriteLine(HtmlText);
}
var Location = await App.AzureService.UploadToAzureBlobStorage(FilePath, FileName);
System.Console.WriteLine(Location);
File.Delete(FilePath);
Azure Servce
public async Task<string> UploadToAzureBlobStorage(string filePath, string fileName) {
var conectionString = AppConstant.ConectionString;
var containerName = AppConstant.ContanerName;
var AzureStorage = new BlobContainerClient(conectionString, containerName);
var blob = AzureStorage.GetBlobClient(fileName);
await blob.UploadAsync(filePath, true);
return $"https://notesbucket.blob.core.windows.net/notes/{fileName}";
}
But I get this
https://notesbucket.blob.core.windows.net/notes/Shopping list.rtf
<Error>
<Code>BlobNotFound</Code>
<Message>The specified blob does not exist. RequestId:162ae91a-801e-0042-2978-31fcf1000000 Time:2022-03-06T16:34:41.3417951Z</Message>
</Error>
My url: https://notesbucket.blob.core.windows.net/notes/Shopping list.rtf
FileName: Shopping list.rtf