AZURE - file storage name as GUID

  • Thread starter Thread starter eruig
  • Start date Start date
E

eruig

Guest
I have the following code which Uploads & Downloads Files to Azure Blob Storage. It is named in azure from the System.IO.Path.GetFileName(path). instead of files named in the format test.jpg I want them save using GUID. eg.E9A7AA65-DF21-4A21-ADBE-0BB32B90E6D1. How to I change my code so it stores file in Azure nae that is a Unique Identifier.


Public Async Function UploadAsync(ByVal path As String, ByVal cancelToken As CancellationToken) As Task

Try
Await CreateContainer(cancelToken)

Dim blockBlob As CloudBlockBlob = container.GetBlockBlobReference(System.IO.Path.GetFileName(path))

Await blockBlob.UploadFromFileAsync(path, cancelToken)


Catch ex As OperationCanceledException

Throw New OperationCanceledException("UploadAsync canceled")
End Try
End Function


Private Async Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

Await AZBlob.UploadAsync(PictureBox1.ImageLocation, cancelToken)

End Sub

Continue reading...
 
Back
Top