?? fjfileup.asp
字號:
<!--#include file="../Include/TimeOut.asp"-->
<!--#include file="../Include/AdoConn.asp"-->
<!--#include file="../Include/online.asp"-->
<%
'****************處理上傳附件部分********************
if session("newstitle")<>"" then'修改狀態(tài)
set rst=server.CreateObject ("adodb.recordset")
strsql="select 附件號,附件名 from XT_TD_UserMessage where 消息題名='"+session("newstitle")+"' and 發(fā)送日期='"&session("senddate")&"'"
rst.Open strsql,conn
fjCode=rst("附件號") '存儲數(shù)據(jù)庫中原來附件號
fjName=rst("附件名") '存儲數(shù)據(jù)庫中原來附件名
rst.Close
set rst=nothing
end if
set FileUp=server.createobject("ChinaASP.UpLoad")
Path=server.mappath("\news\fj")
dim iCount
iCount=0
txtFileNameAll=fjName '存儲存入數(shù)據(jù)庫的新附件名
txtFileName="" '存儲當(dāng)前處理的附件名
for each f in fileup.Files
if f.isempty=false then
Response.Write f.filename
Response.Write "<br>"
if instr(f.filename,".doc")=0 and instr(f.filename,".rar")=0 and instr(f.filename,".zip")=0 then
Response.Redirect("../Messagebox/error.asp?info=附件類型不對,只能是.doc\.ZIP\.RAR文檔!")
end if
Randomize
if fjCode="0" then fjCode=cstr(clng(rnd(0)*10000000))
txtFileName=fjCode&"_" & f.filename
if f.filesize<>0 then
else
end if
f.saveas Path & "\" & txtFileName
if instr(fjName,txtFileName)=0 then
txtFileNameAll=txtFileNameAll&"/"&txtFileName
else
txtFileNameAll=fjName'重復(fù)上傳則不寫入數(shù)據(jù)庫
end if
end if
iCount=iCount+1
next
if txtFileNameAll<>"" then
StrSQL="update XT_TD_UserMessage set 附件號='"&fjCode&"',附件名='"&txtFileNameAll&"' where 消息題名='"+session("newstitle")+"' and 發(fā)送日期='"&session("senddate")&"'"
conn.Execute StrSQL
end if
session("newstitle")=""
session("sendate")=""
Response.Write "附件上傳成功!<br>"
querySQL="select * from XT_VD_usermessage where 發(fā)送人編碼='"&session("usercode")&"' order by 發(fā)送日期 desc "
Response.Write "<a href='news_EditList.asp?strsql="&server.URLEncode(querySQL)&"'>返回列表</a>"
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -