日期:2014-05-17  浏览次数:20642 次

图片无法显示
这个帖子发过一次,当时图片显示了,以为解决了但是灵异的是后面又不显示了,又是红叉叉,我对比过路径
数据库路径为~/uploadImgs/文件名.pic和图片实际路径相同。
新闻写入WriteNews.aspx.cs
 uploadfile.PostedFile.SaveAs(Server.MapPath("~\\uploadImgs\\" + newname2 + newext2));
(newname2是文件名,newext2是后缀)

数据库查询语句是:
strsql="select top 10 id,title,descr='&nbsp;&nbsp;'+SUBSTRING(content,0,100)+'......', picture image from news where picture is not null or picture<>'' order by hits DESC";

新闻写入
uploadfile.PostedFile.SaveAs(Server.MapPath("~\\uploadImgs\\" + newname2 + newext2));
求解释。
图片 新闻 数据库

------解决方案--------------------
你显示图片地方呢?是不是用了“/”开头的路径。这个是从站点根开始的路径,你的application路径不同的话会受影响