ASP技巧实例:关于对表单操作的程序
程序员文章站
2022-06-22 11:23:14
inserting form content into database with asp.
<% &nbs...
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
-- 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
相关文章
- 用几行asp代码实现防止表单多次被提交
- asp编程入门进阶(二):认识表单
- 在asp网站设计中表单验证
- asp讲座之二:读取通过表单发送的数据
- 在asp中使用sql语句之9:表单操作
- asp动态生成的javascript表单验证
- asp代码:防止重复多次提交表单的方法
- asp技巧实例:几行代码解决防止表单重
图文推荐