【发布时间】:2011-10-21 20:48:43
【问题描述】:
我想读取使用文件对话框打开的文件的内容,然后将其保存在字节数组中以将其传递给 Web 服务
Stream myStream;
OpenFileDialog saveFileDialog1 = new OpenFileDialog();
saveFileDialog1.Filter = "zip files (*.zip)|*.zip|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
NSITESERVICE.UploadSoapClient obj = new NSITESERVICE.UploadSoapClient();
byte[] filebytes = //what should i pass it over here...
obj.UploadFile("kamal", "p@ssword", filebytes);
// Code to write the stream goes here.
myStream.Close();
}
}
我不知道我错在哪里
感谢任何帮助。谢谢
【问题讨论】:
-
我应该将什么传递给 byte[] 文件字节。