Azure SDK は Windows 8 APP では動作しません。
Windows 8 アプリから Azure Blob Storage に写真をアップロードするにはどうすればよいですか?
実用的なコード サンプルが必要です。
Windows 8 アプリケーションから Blob Storage に写真をアップロードするために、Windows Azure SDK は必要ありません。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);
}
}
必要な作業は、Signed Access Signature と一緒に BLOB への URL を取得することだけです。Nick Harris が、モバイル サービスを使用してこれを行う方法を説明します。