TA的每日心情 | 慵懒 2014-10-21 10:00 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
找到 post_upfile.asp、upfile.asp、z_visual_upfile.asp、NF_visual_upfile.asp、saveannouce_upfile.asp等上传文件(包括所有插件中的上传文件)- v1 i" v# t: K7 E. y5 q! t
6 Q, w) x' ]' j查找文件中的代码:
! ~" J+ l- K- C* ~ FileExt=Lcase(File.FileExt)
1 V& H# o; ~4 }6 M0 @6 d '判断文件类型
9 N% W8 a0 y2 t If CheckFileExt(FileExt)=false then, y& n8 T3 q1 F/ K0 k
Response.write "文件格式不正确,或不能为空 [ 重新上传 ]"
5 n3 }- X* Z$ Y" z: ?+ v7 z EXIT SUB; b/ t5 d9 v4 ?% L3 C
End If9 o7 z! @2 \6 f/ R
( c# ^+ f9 m: r, v
将其中的
0 r( @6 G5 u8 b# n9 a+ d' Z9 p8 B- NFileExt=Lcase(File.FileExt)9 e5 T j/ w `
; m" X, Z- F* A: C$ ~. a- \2 { y
替换为下面代码:
) C O4 C2 P' J/ j+ T
4 ]6 h3 L% T3 V) U- TFileExt=FixName(File.FileExt)
$ V$ X9 V; @) @3 w* w/ U9 W8 \
, W3 f/ F( U& {formPath= Replace(Replace(formPath,Chr(0),""),".","")
( w2 W: @; F5 H6 [* u
: x) G& r6 r5 t: I; t, B+ ~" @下面的代码放在asp文件的最后 "%>"前
1 \0 t; K3 w% T/ L! N1 O8 ]+ a- M0 ?Function FixName(UpFileExt)
* f0 r) f0 G2 A; {* \1 k2 dIf IsEmpty(UpFileExt) Then Exit Function E# M/ Z; f- \
FixName = Lcase(UpFileExt)6 S% h I8 y4 ?/ Q7 Z
FixName = Replace(FixName,Chr(0),"")$ F# ?' D! f% n u! n) a
FixName = Replace(FixName,".","")# q- J$ o/ k- K1 c+ b
FixName = Replace(FixName,"asp","")& y# O1 @! M! X8 p% R# l Q
FixName = Replace(FixName,"asa","")
/ ~3 R/ F# G8 A$ tFixName = Replace(FixName,"aspx","")0 @/ D p. z$ n& z4 Z
FixName = Replace(FixName,"cer",""): R/ d( U6 S- z+ g+ M' \, z6 h
FixName = Replace(FixName,"cdx","")' }& h( G$ [7 H( ]" X
FixName = Replace(FixName,"htr","")( _1 X% s5 @! {2 ? B
FixName = Replace(FixName,"php",""). r4 w9 E& \( w: \8 h
End Function( P, n' G% |) l+ P' ?6 p& }
; h, ~& y) } q2 _7 l
R" s- n( j l |
|