Silverlight 如何将位图传送到服务器?

Silverlight 如何将位图传送到服务器?,silverlight,Silverlight,编写我的第一个silverlight应用程序 我需要提供一些位图,客户将选择(使用OpenFileDialog)到服务器端(使用web服务) 客户选择位图后-我无法访问文件并中断按字节排列的数组,因为我在OpenFileDialog对象属性上看不到文件完整路径 我怎么做 (我有一个获取位图并将位图作为字节数组返回的方法)我以前做过,下面是其中的一部分: OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Images (*

编写我的第一个silverlight应用程序

我需要提供一些位图,客户将选择(使用OpenFileDialog)到服务器端(使用web服务)

客户选择位图后-我无法访问文件并中断按字节排列的数组,因为我在OpenFileDialog对象属性上看不到文件完整路径

我怎么做


(我有一个获取位图并将位图作为字节数组返回的方法)

我以前做过,下面是其中的一部分:

OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Images (*.png; *.jpg)| *.png; *.jpg";
dialog.Multiselect = false;
if (dialog.ShowDialog() == true)
{
  using (System.IO.Stream stream = dialog.File.OpenRead())
  {
    BinaryReader binaryReader = new BinaryReader(stream);
    // here are the bytes you want, put them somewhere to send them to the server
    byte[] imageBytes = binaryReader.ReadBytes((int)stream.Length);

    // here is the filename if you need it
    string filename = System.IO.Path.GetFileNameWithoutExtension(dialog.File.Name);
    stream.Close();
  }
}