<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      圖片數據的存與取示例

      [摘要]圖片數據存入數據庫: sqlstr="select * from "&tbname&" where id is null" ...
      圖片數據存入數據庫:
              sqlstr="select * from "&tbname&" where id is null"
              set rs=server.createobject("adodb.recordset")
              rs.Open sqlstr,conn,1,3
              rs.AddNew ()
              rs("title")=title
              rs("filename")=filename
              rs("filetype")=filetype
              rs("thelevel")=thelevel
              rs("uploaddate")=date()
              rs("uploadip")=request.ServerVariables("REMOTE_ADDR")
              rs("contenttype")=contenttype
              rs("data").AppendChunk (binstr)
              rs("size")=size
              rs("offset")=offset
              rs.Update
              rs.Close()

      讀取顯示:
          rs.Open sqlstr,conn,3
          if not rs.EOF then
                  contenttype=rs("contenttype")
                  binstr=rs("data").GetChunk(rs("size")+rs("offset"))
                  if rs("offset")=1 then
                      binstr=midb(binstr,2)
                  end if
                  if instr(contenttype,"text/")=1 or _
                     instr(contenttype,"image/")=1 or _
                     instr(contenttype,"application/msword")=1 then
                      response.contenttype=trim(contenttype)
                      response.binarywrite binstr
                  else
                      response.addheader "Content-Disposition","attachment;filename="""&rs("filename")&""""
                      response.contenttype=trim(contenttype)
                      response.binarywrite binstr
                  end if
                  if request("preview")<>"yes" then
                      sqlstr="update "&tbname&" set downtimes=downtimes+1 where id="&fileid
                      conn.Execute sqlstr
                  end if
          end if
      說明:
      對于超長的二進制數據(如圖像數據)要使用fieldname.AppendChunk() 和fieldname.GetChunk()來讀寫。



      日韩精品一区二区三区高清