简体   繁体   中英

Windows Phone uploading images to azure blob service

I want to upload a photo from my phone to azure blob.

Im using this link http://www.windowsazure.com/en-us/develop/mobile/tutorials/upload-images-to-storage-wp8/

there is no error or a exception, it just i cant see it and i know the binding is correct, even when i open the link of the image, there is no photo found.

there is a question similar to this one here Upload image to Azure blob storage from Windows Phone. Not creating

This is what I'm doing

PhotoChooserTask chooser;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    Refresh();
    base.OnNavigatedTo(e);
}
private void PhotoChooserBtn_Click(object sender, RoutedEventArgs e)
{
    chooser = new PhotoChooserTask();
    chooser.Completed += chooser_Completed;
    chooser.Show();
}

Stream stream = null;
void chooser_Completed(object sender, PhotoResult e)
{
    stream = e.ChosenPhoto;
    BitmapImage sourceImg = new BitmapImage();
    sourceImg.SetSource(stream);

    ProfileImage.Source = sourceImg;
}

async private void SaveBtn_Click(object sender, RoutedEventArgs e)
{
    Images images = new Images() { Username = "7elbeh" };
    InsertImage(images);
}

private void RefreshBtn_Click(object sender, RoutedEventArgs e)
{
    Refresh();
}

please help.

我有相同的错误,解决我将Stream转换为数组并使用UploadFromByteArrayAsync

byte[] array = imageStream.ToArray(); await blobFromSASCredential.UploadFromByteArrayAsync(array, 0, array.Length);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM