在asp.net中动态创建文件uploder动态保存图像
问题描述:
我动态创建了文件上传控制器并将图像保存到数据库。
之后我想在用户想要编辑记录时显示该图像。
i had created file upload controller dynamically and save image to the database.
after that i want to display that image when user want to edit record.
答
foreach(控制ctrl in placeHolder.Controls)
{
if(ctrl is FileUpload)
{
FileUpload fUl =(FileUpload)ctrl;
postedFile.Add(fUl.ID,new byte [fUl.PostedFile.ContentLength]);
}
}
之后我用IDictionary添加该文件,但问题是我无法建立逻辑来检索图像来自数据库。
foreach (Control ctrl in placeHolder.Controls)
{
if (ctrl is FileUpload)
{
FileUpload fUl = (FileUpload)ctrl;
postedFile.Add(fUl.ID, new byte[fUl.PostedFile.ContentLength]);
}
}
after that i add that file with IDictionary but the problem is that i am not able to establish a logic to retrieve the image from database.