如何在服务器端上载图片wp7. [英] How to upload image wp7 serverside.?

查看:67
本文介绍了如何在服务器端上载图片wp7.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有IsolatedStorageFile,该文件是图像,因此我想将此图像上传到服务器端以使用Avatar,以便如何上传图像的字节[].

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.

我的代码是这样的.

 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);

如何将该字节[]上传到webClient或HttpwebRequest.?

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

谢谢.!

推荐答案

您是否签出了以下链接:

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

这篇关于如何在服务器端上载图片wp7.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆