Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Upload Picture Windows Phone

$
0
0

Hi,

i'm trying to upload a picture to a windows phone 8.1 app xamarin forms. When I call it I open this which opens the interface to select a picture

 FileOpenPicker filePicker = new FileOpenPicker();
            filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            filePicker.ViewMode = PickerViewMode.Thumbnail;

            filePicker.FileTypeFilter.Add(".png");
            filePicker.FileTypeFilter.Add(".jpeg");
            filePicker.FileTypeFilter.Add(".jpg");

            filePicker.PickSingleFileAndContinue();

Now once that has ran and you select the picture it runs the OnActivated method and i have this here

  FileOpenPickerContinuationEventArgs arguments = continuationEventArgs as FileOpenPickerContinuationEventArgs;
                        StorageFile file = arguments.Files.FirstOrDefault();
                        byte[] test = await ReadFile(file);
                        Stream stream = new MemoryStream(test);
                        HttpStreamContent streamContent = new HttpStreamContent(stream.AsInputStream());
                        Stream InputStream = null;
                        using (MemoryStream streamReader = new MemoryStream())
                        {
                           // InputStream.CopyTo(streamReader);
                            test = streamReader.ToArray();
                        }

I convert it to a byte array but I don't know how to upload the byte array to the server. I don't have a URL to pass to it.

Any help would be great, Thanks


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>