功能:判断扩展名是否合法
sAllowExt = "gif|jpg|jpeg|png|bmp"
---------------------------------------
Sub CheckValidExt(sExt)
Dim b, i, aExt
b = False
aExt = Split(sAllowExt, "|")
For i = 0 To UBound(aExt)
If LCase(aExt(i)) = sExt Then
b = True
Exit For
End If
Next
If b = False Then
'response.redirect "upload.asp" ---当以上条件成立,只用这一行时能正确运行,非法扩展名文件不会上传
response.write "<script language=javascript>" ---注释掉上一行而用这几行,就不行,非法扩展名文件也会上传
response.write "window.alert(""不允许上传的文件类型!"");"
response.write "window.location.href='newupload.asp';"
response.write "</script>"
'response.write "<script language=javascript>window.alert(""不允许上传的文件类型!"");window.location.href='upload.asp';</script>" ---以上四行换成一行也不行
End If
End Sub