How to upload image wp7 serverside.?

扶醉桌前 提交于 2020-01-03 04:20:29

问题


hello I have IsolatedStorageFile and this file is image so I want to upload this image to the serverside for the use of Avatar so how I can upload my byte[] of image.

my code like this.

 using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                // Open the file - error handling omitted for brevity
                // Note: If the image does not exist in isolated storage the following exception will be generated:
                // System.IO.IsolatedStorage.IsolatedStorageException was unhandled 
                // Message=Operation not permitted on IsolatedStorageFileStream 
                using (IsolatedStorageFileStream isfs = isf.OpenFile("myImage.jpg", FileMode.Open, FileAccess.Read))
                {
                    // Allocate an array large enough for the entire file
                    data = new byte[isfs.Length];
                    // Read the entire file and then close it
                    isfs.Read(data, 0, data.Length);
                    isfs.Close();
                }
            }

            // Create memory stream and bitmap
            MemoryStream ms = new MemoryStream(data);
            BitmapImage bi = new BitmapImage();
            // Set bitmap source to memory stream
            bi.SetSource(ms);

how I can upload this byte[] into webClient or HttpwebRequest.?

Thank you.!


回答1:


Have you checked out the following link: File Upload. This should work.



来源:https://stackoverflow.com/questions/10832556/how-to-upload-image-wp7-serverside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!