码迷,mamicode.com
首页 > 其他好文 > 详细

上传转字节再转图片

时间:2014-09-16 14:01:10      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:winform   for   文件   sp   log   c   ad   new   r   

winform版

 

DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
string path = openFileDialog1.FileName;
FileStream file = new FileStream(path, FileMode.Open);
int sum=(int)file.Length;
byte[] bytes = new byte[sum];
file.Read(bytes,0,sum);
FileStream files = File.Create(@"D:\1.jpg");
files.Write(bytes, 0, sum);
}
else
{
MessageBox.Show("请选择文件", "");
}

上传转字节再转图片

标签:winform   for   文件   sp   log   c   ad   new   r   

原文地址:http://www.cnblogs.com/lanhaipeng/p/3974664.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!