public async Task <IActionResult> OnPost() { // Check if URL/Image is in the expected state (such as, it exists) if (Image != null) { // get a temp location on your server to store the file. // If you want to set a specific location, look back at Lab 11. var filePath = Path.GetTempFileName(); using (var stream = new FileStream(filePath, FileMode.Create)) { await Image.CopyToAsync(stream); } var container = await BlobImage.GetContainer("posts"); // upload the image BlobImage.UploadFile(container, Image.FileName, filePath); CloudBlob blob = await BlobImage.GetBlob(Image.FileName, container.Name); Post.URL = blob.Uri.ToString(); } await _posts.AddPost(Post); return(RedirectToPage("Index")); }