还是关于asp参数传递问题

sealor109 2004-12-03 01:53:19
我现在有两个页面,一个叫add_picture_info.asp,一个叫upload_picture.asp
add_picture_info.asp是输入图片的基本信息的,有三个字段:图片名称,图片来源,图片提供者
upload_picture.asp是保存图片的基本信息的,要对数据库进行操作,add_picture_info.asp把从它获得三个字段的信息传递给upload_picture.asp.

具体的源代码如下:
文件一:
conn_db.asp

<%
'连接数据源
dim conn, admin_user, admin_type

admin_user =session("admin_user")
admin_type =session("admin_type")
login_id=session("login_id")
cur_url2233 =request("url")

if isnull(login_id) or login_id="" then
response.redirect "/admin/login.asp?purl="&request("url")
end if

Set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="Provider=SqlOleDb;Data Source=192.168.0.105;Initial CataLog=sms;User ID=sms;PASSWORD=111111"
conn.Open
if admin_type <> "0" and instr(cur_url2233, "efault.asp")=0 and instr(cur_url2233, "common") =0 then
set rs2233=conn.execute("select * from admin_user_auth where login_id='" & login_id & "' and charindex(sub_url, '" & cur_url2233 & "') >0")
if rs2233.eof then
response.write "您没有权力访问此功能. <a href=javascript:history.back(1)>返回</a>"
rs2233.close
conn.close
response.end
end if
rs2233.close
end if
%>

文件二:
add_picture_info.asp

<HTML><HEAD><TITLE>添加图片</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE>.big {
FONT-FAMILY: Arial, Helvetica, 宋体; FONT-SIZE: 13pt; FONT-WEIGHT: bold
}
.cur {
COLOR: #ff0000; FONT-FAMILY: 宋体; FONT-SIZE: 9pt
}
.chn {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt
}
.dir {
FONT-FAMILY: 宋体; FONT-SIZE: 11pt; FONT-WEIGHT: bold
}
.sub {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt
}
.hdr {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt; FONT-WEIGHT: bold
}
.itm {
FONT-FAMILY: 宋体; FONT-SIZE: 11pt
}
.eng {
FONT-FAMILY: Arial, Helvetica, 宋体; FONT-SIZE: 9pt
}
.con {
FONT-FAMILY: 宋体; FONT-SIZE: 10pt
}
A.hover {
COLOR: red
}
td {
FONT-SIZE: 9pt
; line-height: 19px
}
</STYLE>

</HEAD>
<BODY>
<!-- #include file="../conn_db.asp" -->
<%
name=request.form("name")
provider=request.form("provider")

%>

<CENTER>
<table border=0 cellpadding=2 cellspacing=0 width=468 style="border-collapse: collapse" bordercolor="#111111">
<tbody>
<tr>
<td width="628" align="center">
添加图片</td>
</tr>
</tbody>
</table>

<div align="center">
<center>

<table border=0 cellpadding=0 cellspacing=0 width=468 class=itm style="border-collapse: collapse" bordercolor="#111111"
height="206">
<tr>
<td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFCC00" width="100%" height="20">  填写信息:</td>
</tr>
<tr>
<td bgcolor="#000000" width="59%" height="1"></td>
</tr>
</table></td>
</tr>
<form action="images/upload_picture.asp?name=<%="name"%>&provider=<%="provider"%>" method="post" enctype="multipart/form-data">

<tr>
<td align=right width=119 bgcolor="#EEEEEE" height="26">图片名称: </td>
<td bgcolor="#EEEEEE" height="26" width="349"> <input type=text name="name" size=36>
</td>
</tr>

<tr>

<td align=right bgcolor="#EEEEEE" height="32">图片来源: </td>
<td bgcolor="#EEEEEE" height="32"><input name="picture" size=36 type="file">
</td>
</tr>
<tr>
<td align=right width=119 bgcolor="#EEEEEE" height="32">提供者: </td>
<td bgcolor="#EEEEEE" height="32" width="349"> <input type=text name="provider" size=28 maxlength=50>
</td>
</tr>
<tr>
<td colspan=2 align=center height="32"> <input type=submit value="添 加" id=submit2 name=send >
 
<input type=reSet value="清 除" id=reSet2 name=clear2>

</form></td></tr>

<tr>
<td colspan=2 height="45"> </td>
</tr>
<tr>
<td colspan=2 height="45"></td>
</tr>
</table>

</center>
</div>


<SCRIPT language=javascript>

</SCRIPT>
<HR noShade SIZE=1 width=468>
<p style="line-height: 150%"><small>版权所有:  
制作与维护:<br>
<br>
</p>
</CENTER>
</small>
<!-- #include file="../close_db.asp" -->
</BODY>
</HTML>


文件三:
upload_picture.asp



<%
Server.ScriptTimeOut = 500
%>
<!-- #include file="../conn_db.asp" -->
<%

name=request("name")
provider=request("provider")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图片上传</title>
</head>
<body>
<p align="center">图片上传</p>
<%

dim IronUpload,path,File
dim startTime, EndTime
StartTime = Timer()
set IronUpload=Server.createobject("Ironsoft.UpLoad")
path=server.mappath(".")
response.write "<br>编码数据大小: " & IronUpload.TotalByte
response.write "<br>文件保存路径: " & path
response.write "<br>数据域长度: " & IronUpload.FormLength
response.write "<br>文件域长度: " & IronUpload.FileFormLength
set File = IronUpload.IronFileForm("picture")

'Save File
if not File.IsEmpty then
response.write "<br>文件1: 文件名:" & File.FileName & ", 文件类型:" &File.FileType & ", 文件大小:" & File.FileSize & ", 扩展名:" & File.ExeName
File.SaveAsFile Server.mappath(File.FileName)
end if

set ob=nothing
EndTime = Timer()
response.write "<br>用时:" & EndTime - StartTime & "s"
'Save the File Path to the Database.
Dim FullPath
FullPath=path&"\"&File.FileName
Response.Write "<br>数据库中存放的路径值:" &FullPath

conn.Execute "insert into picture_info(name,PROVIDER,cur_time,down_count,picture_path) values ('"&name&"','"&provider&"',getdate(),'0','"&FullPath&"')"
Response.Write "<br>" & "Upload OK!"
conn.Close
Set conn=nothing
%>

</body>
</html>


问题很简单,就是如何把在add_picture_info.asp这个页面中获得的name和provider两个变量值传递给下一个页面upload_picture.asp

各位都给点建议吧
...全文
412 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zyddamon 2004-12-03
你只贴有用的嘛 这么多 好痛苦 算了
回复
yqh1314 2004-12-03
但是登陆的时候已经得到它的ID 了! 根据 ID 来找其保存的东西应该不成问题吧!
回复
sealor109 2004-12-03
fangq(随·风)

你的想法不错,只是这个数据库是别人设计的,要是两个页面分开对数据库操作,很难实现两次对数据库的操作都是作用在同一个记录上.
回复
fangq 2004-12-03
enctype="multipart/form-data"
的确用了这个表单方式,用request是不能接收的!
个人感觉!先把图片存入数据库记录它的ID号,在另一个页面将图片相关信息通过ID写入数据库!
回复
3573745 2004-12-03
你写的东西太长了
懒得砍了!
说清楚误问题咯。别
回复
hhjjhjhj 2004-12-03
呵呵,楼主先学学“提问的艺术”----
贴了太多无关代码!

解决办法:用隐藏的INPUT传数据
<input type=hidden name=xxxxxxx value=<%=asp数据%>>
回复
davs 2004-12-03
<form action="images/upload_picture.asp?name=<%="name"%>&provider=<%="provider"%>" method="post" enctype="multipart/form-data">
用了enctype="multipart/form-data" 就不能用request来收表单数据
回复
davs 2004-12-03
这样接收
IronUpload.form("name")
IronUpload.form("provider")
回复
sealor109 2004-12-03
我已经因为这个问题而被折磨的两天了,痛苦万分
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-12-03 01:53
社区公告
暂无公告