程序出现错误,可能提交了非法参数或数据
人人为我,我为人人!
这是filedel.asp的代码。
<!--#include file="conn.asp"-->
<%
On Error Resume Next
function DelFile(fPath,fName)
set fso=server.createobject("Scripting.filesystemobject")
if fso.fileexists(server.mappath(""&fPath&"/"&fName))=true then
fso.deletefile(server.mappath(""&fPath&"/"&fName))
End if
End Function
function DelAryFile(fAry,fPath)
Dim i
For i=0 To Ubound(fAry)
DelFile fPath,fAry(i)
Next
End Function
function DelDBFile(wStr,con)
con.execute "delete from [file] where "&wStr
end function
function getSqlQueryStr(Field,idStr)
Dim reStr
reStr=Field&"="&Replace(idStr,"|"," Or "&Field&"=")
getSqlQueryStr=reStr
End function
Dim id,filename,idAry,fAry,QueStr
id=trim(request("id"))
filename=trim(request("filename"))
if id <> "" or filename <> "" then
id=Mid(id,1,len(id)-1)
filename=Mid(filename,1,len(filename)-1)
idAry=Split(id,"|")
fAry=Split(filename,"|")
if isArray(idAry)=false Or isArray(fAry)=false Then
DelFile SavePath,request("filename")
DelDBFile "id="&request("id"),conn
else
QueStr=getSqlQueryStr("id",id)
DelDBFile QueStr,conn
DelAryFile fAry,SavePath
end if
IF Err.Number<>0 Then
Response.write "程序出现错误,可能提交了非法参数或数据"
Else
Response.Redirect("show.asp")
End IF
Else
Response.write "没有接收到任何参数及数据,提交数据错误"
End IF
%>
filedel.asp修改后的代码