眼镜鱼的博客

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
//1.流转换为字节数组,fileUpload为.net上传控件
Stream stream = fileUpload.FileContent;
byte[] fileBuffer = new byte[stream.Length];
stream.Read(fileBuffer,0,(int)stream.Length);
//2.字节数组转换为字符串
string fileBody = System.Text.Encoding.Default.GetString(fileBuffer);

//3.字符串转换为字节数组
string key = "private key";
byte[] buffer = System.Text.Encoding.Default.GetBytes(key);



posted on 2009-10-13 20:26  带眼镜的鱼  阅读(1753)  评论(0编辑  收藏  举报