科汛V6上传附件,如果上传的文件名含有单引号会出错,原因是脚本冲突
现将修改方法说明如下:
后台上传处理文件admin/include/upfilesave.asp
找到以下代码
ReturnValue = CheckUpFile(FilePath,MaxFileSize,AllowFileExtStr,AutoReName)
if ReturnValue <> "" then
ReturnValue = Replace(ReturnValue,"'","\'")
KS.AlertHintScript ReturnValue
Response.End()
else
If UpType="Field" Then
Response.Write("<script language=""JavaScript"">")
Response.Write("parent.document.all."& FieldName & ".value='" & replace(TempFileStr,"|","") & "';")
Response.Write("document.write(' <font size=2>恭喜,上传成功!</font>');")
Response.Write("document.write('<meta http-equiv=\'refresh\' content=\'2; url=../KS.UpFileForm.asp?ChannelID=" & ChannelID & "&UpType=Field&FieldID=" & UpFileObj.Form("FieldID") &"\'>');")
Response.Write("</script>")
Else
TempFileStr=replace(TempFileStr,"'","\'")
Select Case BasicType
Case 1 '文章
Response.Write("<script language=""JavaScript"">")
if UpType="File" Then '上传附件
If KS.C_S(ChannelID,34)=0 Then
Response.Write("parent.ArticleContent.InsertFileFromUp('" & TempFileStr &"','" & KS.Setting(3) & "');")
Else
注意红色的为增加的代码,按上面修改即可
同样前台上传处理文件在user/upfilesave.asp
找到如下代码
if ReturnValue <> "" then
ReturnValue = Replace(ReturnValue,"'","\'")
Response.Write("<script language=""JavaScript"">")
Response.Write("alert('" & ReturnValue & "');")
if basictype=999 then
Response.Write("window.close();")
else
Response.Write("history.back(-1);")
end if
Response.Write("</script>")
else
If UpType="Field" Then
Response.Write("<script language=""JavaScript"">")
Response.Write("parent.document.getElementById('"& FieldName & "').value='" & replace(TempFileStr,"|","") & "';")
Response.Write("document.write(' <font size=2>恭喜,上传成功!</font>');")
Response.Write("document.write('<meta http-equiv=\'refresh\' content=\'2; url=user_upfile.asp?ChannelID=" & ChannelID & "&Type=Field&FieldID=" & UpFileObj.Form("FieldID") &"\'>');")
Response.Write("</script>")
Response.End()
End If
TempFileStr=replace(TempFileStr,"'","\'")
Select Case BasicType
Case 1 '文章中心的上传缩略图
Response.Write("<script language=""JavaScript"">")
if UpType="File" Then '上传附件
做以上修改即可
更多应用请不定时参看 http://www.kesion.com/kfrz/