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等上传文件(包括所有插件中的上传文件)
* b* k/ J! K7 D; t% I, s- H; H8 \" P1 W; \# L, {
查找文件中的代码:
: }% z# k. ?8 V! g( m# t FileExt=Lcase(File.FileExt)# i# M) b6 J- d; H" X. _4 O
'判断文件类型6 t) ?# [& S5 g" p
If CheckFileExt(FileExt)=false then/ Y7 y1 z$ G/ X0 }) c
Response.write "文件格式不正确,或不能为空 [ 重新上传 ]"
6 }2 d* ^$ |) f5 O( O, r, Y EXIT SUB+ e# F- Y, W- T: t4 B
End If9 v+ z# v# e: N9 n
( J% s) l- a" T将其中的3 @3 i0 c \! L
FileExt=Lcase(File.FileExt)
/ x! u r9 s: x! U2 c2 I6 i% [- w9 d1 k! t6 C
替换为下面代码:
" q3 y% D1 M& e+ `8 p( ^! F1 r$ p9 J' n6 \9 V6 t k0 ?5 J- Q
FileExt=FixName(File.FileExt)! D* @$ C( S3 ~0 W- ^6 M
B; r* I% L, n Z% f; {- W& e: rformPath= Replace(Replace(formPath,Chr(0),""),".","")9 p3 r9 p7 |* l
' K- s5 P* ^4 L: ^+ u
下面的代码放在asp文件的最后 "%>"前- i) `/ s% j, E* t5 T
Function FixName(UpFileExt)1 g) c; {; Y! ^
If IsEmpty(UpFileExt) Then Exit Function
/ c/ M1 }8 n: L7 x5 w* x. C# j# EFixName = Lcase(UpFileExt)
6 V$ Q" K# J( E" t3 UFixName = Replace(FixName,Chr(0),"")# _2 {; W7 Q: U' m& D
FixName = Replace(FixName,".","")
+ O* C T, ^/ g# @/ U' x9 lFixName = Replace(FixName,"asp","")1 T' M1 N- `' S* [. S6 \6 x- z# r( E
FixName = Replace(FixName,"asa","")$ R" _+ {. @& }
FixName = Replace(FixName,"aspx","")
: g* Z3 I$ v0 B8 OFixName = Replace(FixName,"cer","")
+ s: _; E! k6 [6 MFixName = Replace(FixName,"cdx","")8 Q/ ^. h, U& a# g" n0 p
FixName = Replace(FixName,"htr","")4 S3 }/ a& n5 t) J8 d+ h: _
FixName = Replace(FixName,"php","")
7 Z% }7 y6 t3 b& D7 OEnd Function
0 ^% Q" }" Q5 v; {* q( [& i8 L, D; |6 Z3 U3 D2 L
6 x ]6 f7 Q9 r% Z/ E |
|