最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp 利用文件上传组件upload_5xsoft文件上传
时间:2022-07-02 22:36:26 编辑:袖梨 来源:一聚教程网
我们是利用upload文件上传组件进行文件上传哦。
<%Server.ScriptTimeOut=5000%>
css%>" type="text/css">
<%dim upload,file,formName,formPath,iCount,exeec,wjm
set upload=new upload_5xsoft
formPath="FJ/"
ly=upload.form("content")
yhm=upload.form("yhm")
zid=upload.form("zid")
ys=upload.form("ys")
yyzm = upload.form("yzm")
zt=upload.form("zt")
ztid=upload.form("ztid")
cz=upload.form("cz")
tp=upload.form("tp")
if tp = "http://" then tp = ""
ly=xrzh(ly)
if cz = "" then
fhlj = "bbs_list.asp?zid="&zid
else
fhlj = "bbs_tj.asp?page=1000&zt="&zt&"&ztid="&ztid&"&zid="&zid
zid = ztid
end if
if yyzm <> session(sessionvalue & "yzm") then redirect fhlj
zhhf = jdsj
if yhm = "" then yhm = "游客"''request.servervariables("remote_addr")
for each formName in upload.objFile ''列出所有上传了的文件
set file = upload.file(formName)
if file.FileSize>0 then
kzm = lcase(right(file.filename,4))
if instr(",.mpg.asf.avi.mp3.swf.mpeg.png.gif.bmp.jpg.wma.wmv.txt",kzm)<= 0 then response.Redirect hflj
if file.filesize > 819200 then%>
<%end if
wjdx = file.filesize
wjm = formpath&replace(cstr(date),"-","") & cstr(Replace(Timer(), ".", "")) & kzm
file.SaveAs Server.mappath(wjm)
dx = cstr(file.filesize/1024)
if len(dx) >6 then dx=left(dx,6)
end if
next
if trim(zt) <>"" then
sql = "select * from yrwl_tb_lt order by id desc"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if sjk <> "" then
if rs.eof then
id = "1"
else
id = cstr(rs("id")+1)
end if
end if
rs.addnew
if sjk = "" then
if rs.eof then
id = "1"
else
id = cstr(rs("id"))
end if
end if
rs("yhm") = yhm
rs("zt") = zt
rs("ly") = ly
if wjm = "" and tp <> "" then wjm = tp
rs("fj") = wjm
rs("dx") = dx
rs("dj") = 0
rs("zd") = "5"
rs("hf") = 0
if cz = "" then
rs("zid") = "s"
rs("zhhf") = jdsj & " "&yhm
rs("lb") = zid
else
rs("zid") = zid
sql = "select * from yrwl_tb_lt where id=" & zid
set rs1 = server.createobject("adodb.recordset")
rs1.open sql,conn,1,3
rs1("zhhf") = jdsj & " "&yhm
rs1.update
rs1.close
end if
rs("sj") = jdsj
rs.update
rs.close
if instr(yhm,".") = 0 and yhm <> "游客" then
exec="select * from yrwl_tb_admin where yhm='"&yhm&"'"
rs.open exec,conn,3,3
cs = rs("cs")
qm = rs("qm")
if isnull(cs) then cs = 0
if cs="" then cs=0
exec="update yrwl_tb_admin set cs=" & cstr( cs + 3 ) & " where yhm='" & yhm & "'"
conn.execute exec
end if
if cz = "" then
''读文件
if wjm <> "" then
kzm = lcase(right(wjm,3))
if instr(wjm,"http") = 0 then wjm = "../" & wjm
xswjm = gqzh(wjm)
if len(wjm)>4 and instr(wjm,"FJ")>0 then
tpxs = xswjm & "
附件下载:[" & wjm &"]"
else
tpxs = xswjm
end if
if tpxs = "" or (instr(wjm,"swf")>0) then tpxs = ""
end if
set fso = Server.Createobject("Scripting.FileSystemObject")
set file=fso.opentextfile(Server.mappath("tbtb.txt"),1,False)
do while file.AtEndOfStream<>true
wjnr = wjnr & file.ReadLine() & chr(13)
loop
file.close
set file = nothing
set fso = nothing
if isnull(qm) then qm = ""
ly = replace(ly,chr(13),"
")
wjnr = replace(wjnr,"$ti$",zt)
wjnr = replace(wjnr,"$sj$",jdsj)
wjnr = replace(wjnr,"$zt$", kill_keyword(zt))
wjnr = replace(wjnr,"$ly$", kill_keyword(ly) & "
" & tpxs & "--------------------------------------
个性签名:"&qm&"")
wjnr = replace(wjnr,"$zid$",zid)
wjnr = replace(wjnr,"$qm$",qm)
wjnr = replace(wjnr,"$ztid$",id)
if instr(yhm,".")>0 then yhm=left(yhm,instrrev(yhm,"."))&"*"
wjnr = replace(wjnr,"$fyr$",yhm)
wjnr = replace(wjnr,"$lxfs$",session(sessionvalue & "lxfs"))
''写文件
wj = Server.mappath( "tb/" & id & ".htm" )
set myfileobject=server.CreateObject("Scripting.FileSystemObject")
set mytextfile=myfileobject.CreateTextFile(wj)
mytextfile.WriteLine wjnr
mytextfile.close
end if
set file=nothing
set upload=nothing ''删除此对象
end if
conn.close
response.redirect fhlj%>
相关文章
- 光遇12.23每日任务怎么做 光遇12月23日每日任务做法攻略 12-23
- 光遇12.23大蜡烛在哪里 光遇12月23日大蜡烛位置攻略 12-23
- 光遇12.23免费魔法有什么 光遇12月23日免费魔法收集攻略 12-23
- 《流放之路2》寻找熔炉任务攻略分享 12-23
- 《流放之路2》德雷文打法技巧分享 12-23
- 《流放之路2》永恒裁判者德雷文具体位置介绍 12-23