久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      ASP上傳圖片到數(shù)據(jù)庫的代碼


      ASP將圖片上傳到數(shù)據(jù)庫的代碼
      <%
      formsize=request.totalbytes
      formdata=request.binaryread(formsize)
      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)
      sql=”select * from pic”
      getdata(sql)
      rs.addnew
      rs(“img”).AppendChunk myData
      rs.update
      rsclose()
      response.clear
      response.write “success!”
      end if
      %>  <%

      ‘這是一段將圖片上傳到數(shù)據(jù)庫的代碼

       

      formsize=request.totalbytes
      ‘獲取請求中包括的總字節(jié)數(shù)

       

      formdata=request.binaryread(formsize)
      ‘保存從客戶端讀取到的二進制數(shù)據(jù)

       

      bncrlf=chrB(13)&chrB(10)
      divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
      ‘分隔標(biāo)志串
      ‘數(shù)據(jù)長度,減1是因為數(shù)據(jù)文件的存取字節(jié)數(shù)問題(可能是AppendChunk方法的問題):
      ‘由于字節(jié)數(shù)為奇數(shù)的圖象存到數(shù)據(jù)庫時會去掉最后一個字符導(dǎo)致圖象不能正確顯示,
      ‘字節(jié)數(shù)為偶數(shù)的數(shù)據(jù)文件就不會出現(xiàn)這個問題,因此必須保持字節(jié)數(shù)為偶數(shù)。

       

      datastart=instrb(formdata,bncrlf&bncrlf)+4
      ‘分隔標(biāo)志串長度

       

      dataend=instrb(datastart+1,formdata,divider)-datastart
      ‘減去分隔標(biāo)志串長度

       

      mydata=midb(formdata,datastart,dataend)
      ‘獲取最終數(shù)據(jù)

       

      sql=”select * from pic”
      getdata(sql)
      ‘getdata為自定義函數(shù),連接、打開數(shù)據(jù)庫、并運行sql語句

      rs.addnew
      ‘添加新的數(shù)據(jù)

       

      rs(“img”).AppendChunk myData
      ‘使用AppendChunk方法添加數(shù)據(jù)

       

      rs.update
      ‘更新數(shù)據(jù)庫

       

      rs.close()
      ‘關(guān)閉數(shù)據(jù)庫

       

      response.clear
      ‘清除緩沖區(qū)中的所有 HTML 輸出

       

      response.write “success!”
      ‘顯示成功信息

       

      end if
      ‘最前面應(yīng)該有if…then語句
      %>

       

      分享到: 更多

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號