Upload Gifs in Silverlight 4

acadenilla
acadenilla used Ask the Experts™
on
Is there a way to upload a gif in silverlight 4
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011
Commented:
Sample code:
WebClient wc = new WebClient();
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;
            string data="";
            if (openFileDialog1.ShowDialog()==true)
            {
                //Open the selected file to read.
                using (System.IO.Stream fileStream = openFileDialog1.SelectedFile.OpenRead())
                {
                    StreamResourceInfo sri = new StreamResourceInfo(fileStream, null);
                    byte[]  array = new byte[sri.Stream.Length];
                    sri.Stream.Read(array, 0, (int)sri.Stream.Length);
                    data = Convert.ToBase64String(array);
                }
            }
           

            wc.UploadStringAsync(new Uri("http://cname/uploadpage.aspx"),data);
        }

Open in new window

Author

Commented:
hey alik,

thanks for the response, but what is in uploadstring?

Do i need to use a webclient call if i am uploading the image to my application?

Allan

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial