主题:传递变量问题
-upfile.asp-
<%
dim ident
ident=request("ident")
%>
<form name="form" method="post" action="saveannouce_upfilet.asp?action=<%="&ident&"%>" enctype="multipart/form-data" >
思想汇报(小结)
<input type="file" name="file1" size=20>
<input type="submit" name="Submit" value="上传">
</form>
-saveannouce_upfilet.asp-
<!--#include FILE="upload.inc.asp"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath
dim ident
dim i,l,fileType,NewFileName
ident=request("action") '接受action传递的值
set upload=New upload_5xSoft ''建立上传对象
formPath=upload.form("filepath") ''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
'取得文件扩展名
fileType = file.FileName '文件名以及扩展名
i = instr(fileType,".") '是否存在“.”
l = Len(fileType)
If i>0 Then
fileType = Right(fileType,l-i+1) '得到扩展名
End If
NewFileName = "&ident&"&date() & fileType
file.SaveAs Server.mappath("updata\"&NewFileName) ''保存文件
end if
set file=nothing
next
set upload=nothing
response.Write(""&ident&"")
response.write "<font size=2>文件上传成功</font>"
%>
</body>
</html>
这个文件的ident没有收到upfile.asp传递过来的action值,很奇怪,望高手修改下,万分感谢!
<%
dim ident
ident=request("ident")
%>
<form name="form" method="post" action="saveannouce_upfilet.asp?action=<%="&ident&"%>" enctype="multipart/form-data" >
思想汇报(小结)
<input type="file" name="file1" size=20>
<input type="submit" name="Submit" value="上传">
</form>
-saveannouce_upfilet.asp-
<!--#include FILE="upload.inc.asp"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath
dim ident
dim i,l,fileType,NewFileName
ident=request("action") '接受action传递的值
set upload=New upload_5xSoft ''建立上传对象
formPath=upload.form("filepath") ''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
'取得文件扩展名
fileType = file.FileName '文件名以及扩展名
i = instr(fileType,".") '是否存在“.”
l = Len(fileType)
If i>0 Then
fileType = Right(fileType,l-i+1) '得到扩展名
End If
NewFileName = "&ident&"&date() & fileType
file.SaveAs Server.mappath("updata\"&NewFileName) ''保存文件
end if
set file=nothing
next
set upload=nothing
response.Write(""&ident&"")
response.write "<font size=2>文件上传成功</font>"
%>
</body>
</html>
这个文件的ident没有收到upfile.asp传递过来的action值,很奇怪,望高手修改下,万分感谢!