当前位置: 移动技术网 > IT编程>开发语言>.net > ASP技巧实例:关于对表单操作的程序

ASP技巧实例:关于对表单操作的程序

2018年10月17日  | 移动技术网IT编程  | 我要评论

重庆会计招聘,蛊惑总裁,djkk

inserting form content into database with asp.

<%
   -- loader. --
   -- version 1.5.2
   -- last updated 12/5/2002
  
   faisal khan
   faisal@stardeveloper.com
   www.stardeveloper.com
   class for handling binary uploads

  class loader
    private dict
    
    private sub class_initialize
      set dict = server.createobject("scripting.dictionary")
    end sub

    private sub class_terminate
      if isobject(intdict) then
        intdict.removeall
        set intdict = nothing
      end if
      if isobject(dict) then
        dict.removeall
        set dict = nothing
      end if
    end sub

    public property get count
      count = dict.count
    end property

    public sub initialize
      if request.totalbytes > 0 then
        dim bindata
          bindata = request.binaryread(request.totalbytes)
          getdata bindata
      end if
    end sub

    public function getfiledata(name)
      if dict.exists(name) then
        getfiledata = dict(name).item("value")
        else
        getfiledata = ""
      end if
    end function

    public function getvalue(name)
      dim gv
      if dict.exists(name) then
        gv = cstr(dict(name).item("value"))
        
        gv = left(gv,len(gv)-2)
        getvalue = gv
      else
        getvalue = ""
      end if
    end function

    public function savetofile(name, path)
      if dict.exists(name) then
        dim temp
          temp = dict(name).item("value")
        dim fso
          set fso = server.createobject("scripting.filesystemobject")
        dim file
          set file = fso.createtextfile(path)
            for tpoint = 1 to lenb(temp)
                file.write chr(ascb(midb(temp,tpoint,1)))
            next
            file.close
          savetofile = true
      else
          savetofile = false
      end if
    end function

    public function getfilename(name)
      if dict.exists(name) then
        dim temp, temppos
          temp = dict(name).item("filename")
          temppos = 1 + instrrev(temp, "")
          getfilename = mid(temp, temppos)
      else
        getfilename = ""
      end if
    end function

    public function getfilepath(name)
      if dict.exists(name) then
        dim temp, temppos
          temp = dict(name).item("filename")
          temppos = instrrev(temp, "")
          getfilepath = mid(temp, 1, temppos)
      else
        getfilepath = ""
      end if
    end function

    public function getfilepathcomplete(name)
      if dict.exists(name) then
        getfilepathcomplete = dict(name).item("filename")
      else
        getfilepathcomplete = ""
      end if
    end function

    public function getfilesize(name)
      if dict.exists(name) then
        getfilesize = lenb(dict(name).item("value"))
      else
        getfilesize = 0
      end if
    end function

    public function getfilesizetranslated(name)
      if dict.exists(name) then
        temp = lenb(dict(name).item("value"))
          if temp <= 1024 then
            getfilesizetranslated = temp & " bytes" &nb
点击复制链接 与好友分享!
相关tag标签
上一篇:在asp中使用类,实现模块化
下一篇:asp技巧:使用fso自动创建多级文件夹的函数
相关文章
热门专题推荐 android sdk
图文推荐

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网