Azure SDK无法在Windows 8 APP上运行。
如何从Windows 8 App上传照片到Azure Blob存储?
我需要工作代码示例。
答案 0 :(得分:2)
您不需要Windows Azure SDK即可将照片从Windows 8应用程序上传到Blob存储。 HttpClient也可以正常工作:
using (var client = new HttpClient())
{
CameraCaptureUI cameraCapture = new CameraCaptureUI();
StorageFile media = await cameraCapture.CaptureFileAsync(CameraCaptureUIMode.PhotoOrVideo);
using (var fileStream = await media.OpenStreamForReadAsync())
{
var content = new StreamContent(fileStream);
content.Headers.Add("Content-Type", media.ContentType);
content.Headers.Add("x-ms-blob-type", "BlockBlob");
var uploadResponse = await client.PutAsync(
new Uri(blobUriWithSAS), image);
}
}
您唯一需要做的就是获取blob的URL和签名访问签名。 Nick Harris explains如何使用移动服务完成此操作。