ASP upload files using File Upload component Upload_5xsoft file

Source: Internet
Author: User
Tags chr file upload

We are using upload file upload components for file upload Oh.

<%Server.ScriptTimeOut=5000%>
<!--#include file= "conn.asp"-->
<!--#include file= "Upload_5xsoft.inc"-->
<title> File Upload </title>
<link rel= "stylesheet" href= "<%=css%>" type= "Text/css" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "><body>
<%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 = "Visitor" ' Request.ServerVariables ("REMOTE_ADDR")

For every formName in Upload.objfile ' lists all uploaded files
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%>
<script language= "JavaScript" >
Alert ("File greater than 800k!");
Window.location= "<%=fhlj%>";
</script>
<%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 <> "tourist" 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
' Read the file
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 & <br> accessories Download: <a href= "& WJM &" target=_blank>["& WJM &"]</a> "
Else
TPXS = XSWJM
End If
If Tpxs = "" or (InStr (WJM, SWF) >0) Then Tpxs = "<iframe id=kj name=kj frameborder=0 width=100% height=500" src= p;wjm& "></iframe>"
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 (), <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> personality Signature: <a title= "&qm&" > "&qm&" </a> ")
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"))
"Write the file
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 ' Deletes this object
End If
Conn.close
Response.Redirect fhlj%>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.