private async Task <string> UploadToRealCloudAsync(MediaFile file) { var mediaStream = file.GetStream(); string filename = Path.GetFileNameWithoutExtension(AlbumPath); // Get the SAS token from the backend var storageToken = await CloudService.GetUpSasTokenAsync(Settings.CurrentSharingSpace, filename); // Use the SAS token to upload the file var storageUri = new Uri($"{storageToken.Uri}{storageToken.SasToken}"); var blobStorage = new CloudBlockBlob(storageUri); // Compress byte[] img; using (var fileStream = System.IO.File.OpenRead(AlbumPath)) { using (BinaryReader br = new BinaryReader(fileStream)) { img = br.ReadBytes((int)fileStream.Length); } } // Resize image (do not forget to add the iOS version of it) byte[] resizedImageArray = ImageResizer.ResizeImageAndroid(img, 720, 486); Stream resizedImage = new MemoryStream(resizedImageArray); await blobStorage.UploadFromStreamAsync(resizedImage); // Set the content type of the current blob to image/jpeg blobStorage.Properties.ContentType = "image/jpeg"; await blobStorage.SetPropertiesAsync(); return(storageToken.Uri.ToString()); }