亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp下輕松實(shí)現(xiàn)將上傳圖片到數(shù)據(jù)庫(kù)的代碼

 更新時(shí)間:2007年11月24日 22:09:47   作者:  
輕松實(shí)現(xiàn)將上傳圖片到數(shù)據(jù)庫(kù)

很久就想自己寫(xiě)一寫(xiě)程序了,不過(guò)由于賴就不想寫(xiě)我,今天剛好有空,所以寫(xiě)了這個(gè)小小的程序很容易一看就知道的,不多說(shuō)了就此開(kāi)始:

  我們做一個(gè)上傳的。數(shù)據(jù)據(jù)庫(kù)的字段就id自動(dòng)編號(hào) big 字段類型是 OLE 呵呵就簡(jiǎn)單的那個(gè)字段好了
  
  uppic.asp上傳程序名
  
  <%
  dim rs 
  dim formsize,formdata,bncrlf,divider,datastart,dataend,mydata
  formsize=request.totalbytes '取得客戶端發(fā)過(guò)來(lái)的大小
  formdata=request.binaryread(formsize)'把客戶發(fā)過(guò)來(lái)的數(shù)據(jù)轉(zhuǎn)成二進(jìn)制作
  bncrlf=chrB(13) & chrB(10)
  divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
  datastart=instrb(formdata,bncrlf & bncrlf)+4
  dataend=instrb(datastart+1,formdata,divider)-datastart
  mydata=midb(formdata,datastart,dataend)'上面總共是取得圖片的二進(jìn)制數(shù)據(jù)

  %>
  <!--#include file="conn.asp"-->
  <%
  sql="select * from pic order by id desc"
  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.Open sql,conn,3,2
  rs.addnew
  rs("big").appendchunk mydata '增加到數(shù)據(jù)庫(kù)中
  rs.update
  set rs=nothing
  set conn=nothing
  %> 
  接下來(lái)是顯示圖片
  
  display.asp
  
  <!--#include file="conn.asp"--> '這個(gè)大家都知道吧,他就是與數(shù)據(jù)庫(kù)連的一個(gè)程序了
    <% 
  id=request("id")
  set rs=server.createobject("ADODB.recordset") 
  sql="select * from pic where id=" & id
  rs.open sql,conn,1,1 
  Response.ContentType = "text/html" '顯示圖片的格式也可以用
  
  'Response.ContentType = "image/gif" 以gif顯示
  
  'Response.ContentType = "image/jpg" 以jpg顯示
  Response.BinaryWrite rs("big") '顯示圖片
  rs.close 
  set rs=nothing 
  set connGraph=nothing 
  
  %> 

 
您可能感興趣的文章:

相關(guān)文章

最新評(píng)論