怎样将一个图像文件插入到数据库中阿

walkany 2004-09-03 08:40:56
能否详细给个例子阿
...全文
85 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wgb219 2004-09-03
  • 打赏
  • 举报
回复
为什么非要把图片存进数据库呢?存个路径多方便啊????
  • 打赏
  • 举报
回复
下载个lyfupload
dsclub 2004-09-03
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=169166
dsclub 2004-09-03
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=178193
zhc168 2004-09-03
  • 打赏
  • 举报
回复
<%
imgdata=Fields("imgFile").Value
Set Rec = Server.CreateObject("ADODB.Recordset")

Rec.Open "SELECT * FROM RenYuan WHERE ID="&ID&"",Conn,1,3

if Rec.RecordCount <> 0 then
ID = Rec("ID")
Rec("PHOTO").appendchunk imgdata
Rec.update

end if

Rec.close
Call CloseDatabase() '关闭数据库对象

set Rec=nothing
%>
zhc168 2004-09-03
  • 打赏
  • 举报
回复
<form name=form1 enctype="multipart/form-data" action="post_RenYuan_pic.asp" method=post onsubmit="return mysubmit(this)">
<input type="file" name="imgFile" onchange="return PreViewPic()" style="font-size:9pt" ACCEPT="image/gif,image/jpg" size="20" class="tx1">
<input type="submit" value=" 上传..." name="B3" style="border:1px double rgb(88,88,88);font:9pt">
</form>

<Script language="javascript">
function mysubmit(theform)
{
if(theform.imgFile.value=="")
{
alert("请点击浏览按钮,选择您要上传的JPEG或GIF照片!")
theform.imgFile.focus();
return (false);
}
else
{
str= theform.imgFile.value;
strs=str.toLowerCase();
lens=strs.length;
extname=strs.substring(lens-4,lens);
if(extname!=".jpg" && extname!=".gif" && extname!=".bmp")
{
alert("请选择JPEG或gif文件!\r\n扩展名:jpg,gif,bmp");
theform.imgFile.focus();
return (false);
}
}
return (true);
}
</script>

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧