asp

位置:IT落伍者 >> asp >> 浏览文章

asp利用文件上传组件upload


发布日期:2022年03月19日
 
asp利用文件上传组件upload

我们是利用upload文件上传组件进行文件上传哦

<%ServerScriptTimeOut=%>
<!#include file="connasp">
<!#include FILE="upload_xsoftinc">
<html>
<head>
<title>文件上传</title>
<link rel="stylesheet" href="<%=css%>" type="text/css">
<meta httpequiv="ContentType" content="text/html; charset=gb"></head>
<body>
<%dim uploadfileformNameformPathiCountexeecwjm
set upload=new upload_xsoft
formPath="FJ/"

ly=uploadform("content")
yhm=uploadform("yhm")
zid=uploadform("zid")
ys=uploadform("ys")
yyzm = uploadform("yzm")
zt=uploadform("zt")
ztid=uploadform("ztid")
cz=uploadform("cz")
tp=uploadform("tp")
if tp = "http://" then tp = ""
ly=xrzh(ly)

if cz = "" then
fhlj = "bbs_listasp?zid="&zid
else
fhlj = "bbs_tjasp?page=&zt="&zt&"&ztid="&ztid&"&zid="&zid
zid = ztid
end if

if yyzm <> session(sessionvalue & "yzm") then redirect fhlj

zhhf = jdsj
if yhm = "" then yhm = "游客"requestservervariables("remote_addr")

for each formName in uploadobjFile 列出所有上传了的文件
set file = uploadfile(formName)
if fileFileSize> then
kzm = lcase(right(filefilename))
if instr("mpgasfavimpswfmpegpnggifbmpjpgwmawmvtxt"kzm)<= then responseRedirect hflj
if filefilesize > then%>
<script language="javascript">
alert("文件大于k!");
windowlocation="<%=fhlj%>";
</script>
<%end if
wjdx = filefilesize
wjm = formpath&replace(cstr(date)"""") & cstr(Replace(Timer() "" "")) & kzm
fileSaveAs Servermappath(wjm)
dx = cstr(filefilesize/)
if len(dx) > then dx=left(dx)
end if
next
if trim(zt) <>"" then
sql = "select * from yrwl_tb_lt order by id desc"
set rs = servercreateobject("adodbrecordset")
rsopen sqlconn
if sjk <> "" then
if rseof then
id = ""
else
id = cstr(rs("id")+)
end if
end if
rsaddnew
if sjk = "" then
if rseof then
id = ""
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") =
rs("zd") = ""
rs("hf") =
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 rs = servercreateobject("adodbrecordset")
rsopen sqlconn
rs("zhhf") = jdsj & " "&yhm
rsupdate
rsclose
end if

rs("sj") = jdsj
rsupdate
rsclose

if instr(yhm"") = and yhm <> "游客" then
exec="select * from yrwl_tb_admin where yhm="&yhm&""
rsopen execconn
cs = rs("cs")
qm = rs("qm")
if isnull(cs) then cs =
if cs="" then cs=
exec="update yrwl_tb_admin set cs=" & cstr( cs + ) & " where yhm=" & yhm & ""
connexecute exec
end if

if cz = "" then
读文件
if wjm <> "" then
kzm = lcase(right(wjm))
if instr(wjm"http") = then wjm = "/" & wjm
xswjm = gqzh(wjm)
if len(wjm)> and instr(wjm"FJ")> then
tpxs = xswjm & "<br>附件下载:<a href=" & wjm & " target=_blank>[" & wjm &"]</a>"
else
tpxs = xswjm
end if
if tpxs = "" or (instr(wjm"swf")>) then tpxs = "<iframe id=kj name=kj frameborder= width=% height= src="&wjm&"></iframe>"
end if

set fso = ServerCreateobject("ScriptingFileSystemObject")
set file=fsoopentextfile(Servermappath("tbtbtxt")False)
do while fileAtEndOfStream<>true
wjnr = wjnr & fileReadLine() & chr()
loop
fileclose
set file = nothing
set fso = nothing
if isnull(qm) then qm = ""
ly = replace(lychr()"<br>")
wjnr = replace(wjnr"$ti$"zt)
wjnr = replace(wjnr"$sj$"jdsj)
wjnr = replace(wjnr"$zt$" kill_keyword(zt))
wjnr = replace(wjnr"$ly$" kill_keyword(ly) & "<br>" & tpxs & "<Br> 个性签名<a title="&qm&">"&qm&"</a>")
wjnr = replace(wjnr"$zid$"zid)
wjnr = replace(wjnr"$qm$"qm)
wjnr = replace(wjnr"$ztid$"id)

if instr(yhm"")> then yhm=left(yhminstrrev(yhm""))&"*"
wjnr = replace(wjnr"$fyr$"yhm)
wjnr = replace(wjnr"$lxfs$"session(sessionvalue & "lxfs"))
写文件
wj = Servermappath( "tb/" & id & "htm" )
set myfileobject=serverCreateObject("ScriptingFileSystemObject")
set mytextfile=myfileobjectCreateTextFile(wj)
mytextfileWriteLine wjnr
mytextfileclose
end if

set file=nothing
set upload=nothing 删除此对象
end if
connclose
responseredirect fhlj%>
</body>
</html>

               

上一篇:asp For Next 循环语句语法与实例

下一篇:asp删除字符串所有空格函数