我正在尝试从我的Windows Phone 8上传图像到azure blob存储。我正在使用CameraCaptureTask,下面的代码可以很好地将图像上传到azure存储。但是,有没有办法一次上传多个图像?
private void save_Click(object sender, RoutedEventArgs e)
{
UploadToAzureBlobStorage(imageStream);
}
private void capture_Click(object sender, RoutedEventArgs e)
{
cam.Show();
}
void cam_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
BitmapImage bmp = new BitmapImage();
bmp.SetSource(e.ChosenPhoto);
imagestream = e.ChosenPhoto;
}
}
private void UploadToAzureBlobStorage(Stream stream)
{
var blobClient = CloudStorageContext.Current.Resolver.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("images");
container.CreateIfNotExist(
BlobContainerPublicAccessType.Container,
response =>
{
var blob = container.GetBlobReference("image.jpg");
blob.UploadFromStream(
stream,
response2 =>
{
MessageBox.Show("Upload complete.");
});
});
}
答案 0 :(得分:0)
存储客户端库允许您上载/下载单个blob。您当然可以使用标准.NET技术并行执行多个blob操作。