MapPath 方法的路径参数中发现无效字符 '/' 或 '\'

sasukenaruto123 2009-12-08 10:32:20
<%
response.charset = "GBK"
dim Sid,ShowId
Sid = request.querystring("Sid")
ShowId = request.querystring("ShowId")


if Sid = "" or not isnumeric(Sid) then
response.write "<script>alert('非法操作');history.back();</script>"
response.end
end if

if ShowId = "" or not isnumeric(ShowId) then
response.write "<script>alert('非法操作');history.back();</script>"
response.end
end if


if request.cookies("guest")("username")="" then
response.write "<script>alert('不是会员不能进!');history.back();</script>"
response.end
end if
%>
<!--#include file="conn.asp"-->
<%
dim rs1,sql1
set rs1 = server.createobject("adodb.recordset")
sql1 = "select * from G_Photo where G_ID="&ShowId
rs1.open sql1,conn,1,1


if rs1.eof then
rs1.Close
set rs1 = nothing
call close_conn
response.write "<script>alert('不存在此目录');history.back();</script>"
response.end

end if


dim rs,sql
set rs = server.createobject("adodb.recordset")
sql = "select * from G_Photo1 where G_ID="&Sid
rs.open sql,conn,1,1

if rs.eof then
call close_rs
call close_conn
response.write "<script>alert('不存在此目录');history.back();</script>"
response.end

end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!--#include file="title.asp"-->
</head>
<body>
<!--#include file="header.asp"-->

<div id="photo">
<h1>添加图片</h1>
<div>
<form name="form1" style="padding-left:260px;padding-top:30px;" method="post" action="photo_show_add_do.asp">
<input type="hidden" value="<%=Sid%>" name="Sid" />
<dl>
<dd>图片名称:<input type="text" name="picname" /></dd>
<dd>图片路径:<input type="text" readonly="readonly" id="picdir" name="picdir" /> <a href="#" onclick="javascript:open('upfile.asp?pic1=<%=rs1("G_PhotoDir")%>&pic2=<%=rs("G_PhotoDir1")%>','upfile','width=400,height=600')">上传</a></dd>
<dd>         
<input type="submit" value="添加图片" name="send" />
  
<label></label>
</dd>
<dd>
<input name="pic1" type="text" id="pic1" value="<%=rs1("G_PhotoDir")%>" />可以看到数据库中的目录
<input name="pic2" type="text" id="pic2" value="<%=rs("G_PhotoDir1")%>" />可以看到数据库中的目录
</dd>
</dl>


<strong></strong>
</form>
</div>
</div>


<!--#include file="footer.asp"-->
</body>
</html>
<%
call close_conn
%>



upfile.asp文件
<!--#include file="upfile.inc"-->

<script type="text/javascript">
function a(url) {
window.opener.document.form1.picdir.value=url;
}
</script>

<%
response.charset = "GBK"
dim picdir
picdir = request.querystring("picdir")
if request.querystring("menu") = "up" then

dim fileup,formpath,file,filename

pic1 = request.querystring("pic1")
pic2 = request.querystring("pic2")

'当点击了上传之后,执行上传操作
set fileup=new Upload_file '实例化一个类 fileup就是一个对象
fileup.GetDate(-1) '
formpath="upload/" & pic1 & "/" & pic2 & "/" '上传的路径

set file=fileup.file("file") '创建一个file对象,通过上面一个对象的file方法传入一个"file"参数
'这个方法能够返回你上传文件的后缀

'只允许上传指定的图片文件

if file.fileext <> "jpg" and file.fileext <> "gif" and file.fileext <> "png" and file.fileext <> "bmp" and file.fileext <> "psd" and file.fileext <> "pam" then
response.write "<script>alert('图片类型必须是jpg,gif,png,bmp这几种');window.close();</script>"
response.end
end if


'建立一个完整的路径
filename = formpath & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now) & "." & file.fileext
file.savetofile server.mappath(filename)

set file = nothing
set fileup = nothing


response.write "<script>a('"&filename&"');</script>"
response.write "<script>alert('图片上传成功');window.close();</script>"

else
%>
<form enctype="multipart/form-data" method="post" action=upfile.asp?menu=up&picdir=<%=picdir%>>
<input type="file" name="file" size="30">
<input type="submit" value="上 传 " />
</form>
<%
end if
%>
...全文
150 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
不耐烦 2009-12-08
  • 打赏
  • 举报
回复
输出你的filename 看看是什么样子的???
内容概要:本文介绍了基于MATLAB实现的PSO-KNN多特征分类预测项目,通过将粒子群优化算法(PSO)与K近邻算法(KNN)相结合,解决传统KNN在高维多特征数据分类面临的参数敏感、特征冗余、分类精度低等问题。项目采用PSO对KNN的关键参数(如K值和特征权重)进行全局寻优,结合数据预处理、特征加权选择、适应度评估与并行化机制,构建了一个高效、自适应的智能分类模型。文详细阐述了模型架构的各个层级,包括数据预处理、特征加权、参数寻优、粒子群协作策略及分类输出,并提供了部分MATLAB代码示例,涵盖主成分分析、粒子初始化、速度更新、交叉验证与结果可视化等关键步骤。; 适合人群:具备一定机器学习基础和MATLAB编程能力,从事数据分析、智能算法研究或工程应用的研发人员、高校研究生及科研工作者,尤其适合关注智能优化与分类预测融合应用的人员。; 使用场景及目标:①应用于医学诊断、金融风控、工业监测等需要高精度多特征分类的领域;②解决KNN算法在高维数据参数选择与特征权重优化难题;③提升分类模型的自动化程度与泛化能力,减少人工调参成本;④为智能算法集成与实际工程落地提供可复用的技术框架。; 阅读建议:此资源以实际项目为导向,结合理论与代码实现,建议读者在理解算法原理的基础上,运行并调试所提供的MATLAB代码,重点关注PSO寻优过程与KNN分类的耦合机制,同时可根据自身数据特点调整适应度函数与参数范围,实现模型迁移与优化。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧