if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
'file.SaveAs Server.mappath(filename) ''保存文件
file.SaveToFile Server.mappath(FileName)
'response.write file.FileName&" 上传成功! <br>"
'response.write "新文件名:"&FileName&"<br>"
'response.write "新文件名已复制到所需的位置,可关闭窗口!"
''===============判断上传文件是否含非法字符串start================
set MyFile = server.CreateObject("Scripting.FileSystemObject")
set MyText = MyFile.OpenTextFile(Server.mappath(FileName), 1) '读取文本文件
sTextAll = lcase(MyText.ReadAll)
MyText.close
set MyFile = nothing
sStr="<%|.getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language="
sNoString = split(sStr,"|")
for i=0 to ubound(sNoString)
if instr(sTextAll,sNoString(i)) then
set filedel = server.CreateObject("Scripting.FileSystemObject")
filedel.deletefile Server.mappath(FileName)
set filedel = nothing
Response.Write("<script>alert('您上传的文件有问题,上传失败!');history.back();</script>")
Response.End
end if
next
我加的这段为什么有的图片也被告过滤了呢。