我想在文件类型的输入控件中显示图像。首先我从数据库中读取 var 二进制数据,然后将其转换为内存流,但我无法将变量传递给<input type="file" />
. 我该怎么做?
<input type="file" name="images" id="images" runat=server />
SqlConnection con = new SqlConnection(stcon);
SqlCommand command = new SqlCommand();
command.CommandText = "select * from image where ImageId=4";
command.Connection = con;
SqlDataAdapter adapt = new SqlDataAdapter(command);
DataTable dt = new DataTable();
adapt.Fill(dt);
MemoryStream memStream = new MemoryStream((byte[])dt.Rows[0][1]);
Stream str;
memStream.CopyTo(str);