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

upload File/Media/Text

$
0
0

hello,
i am trying to implement upload files(photo,video,file,link)
for photo/Video i am using this plugin : https://www.nuget.org/packages/Xam.Plugin.Media/
photo uploaded as shown in this photo:

            //pickphoto
            pickph.Tapped += async (sender, args) =>
            {
                if (!CrossMedia.Current.IsPickPhotoSupported)
                {
                    await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");
                    return;
                }
                var file = await CrossMedia.Current.PickPhotoAsync();


                if (file == null)
                    return;

                imagephoto.Source = ImageSource.FromStream(() =>
                {
                    var stream = file.GetStream();
                    file.Dispose();
                    return stream;
                });
            };

            //pick video
            pickvid.Tapped += async (sender, args) =>
            {
                if (!CrossMedia.Current.IsPickVideoSupported)
                {
                    await DisplayAlert("Videos Not Supported", ":( Permission not granted to videos.", "OK");
                    return;
                }
                var file = await CrossMedia.Current.PickVideoAsync();

                if (file == null)
                    return;

                await DisplayAlert("Video Selected", "Location: " + file.Path, "OK");
            };

i applied the video upload using the same plugin, but it gives me the file path in tmp folder in the device,
i want it to see the result as what i did with image, then after clicking publish the uploaded files will be sent to an external server, is my logic right or not?
and is there any better ressources to achieve the upload to the view first?
thank you in advance,


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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