无组件ASP文件上传源代码
记得在建立一个文件夹"updata"
saveannounce_upload.asp 上传页
------------------------------------
<html>
<head>
<style type="text/css
">
body {font-size:9pt;}
input {font-size:9pt;}
</style>
<title>文件上传</title>
</head>
<body>
<form name="form" method="post" action="saveannouce_upfile.asp" enctype="multipart/form-data" >
文件
<input type="file" name="file1" size=10>
<input type="submit" name="Submit" value="上传">
</form>
</body>
</html>
------------------------------------
saveannouce_upfile.asp 保存文件到服务器
------------------------------------
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath
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>500*1000 then '设置上传文件大小为500K
response.write "<font size=2>文件大小超过了限制 500K [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath("updata\"&file.FileName) ''保存文件
end if
set file=nothing
next
set upload=nothing
response.write "<font size=2>文件上传成功 [ <a href=# o
相关文档:
<%
for i=1 to rs.recordCount '变量i从1循环到数据库中的全部记录数
if (i mod 1 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr align='center'>"
end if
%>
此处为要循环的内容
<%if (i mod 1 = 0) then ......
添加、删除、修改使用
db.Execute(Sql)命令执行操作
╔----------------╗
☆ 数据记录筛选 ☆
╚----------------╝
注意:单双引号的用法可能有误(没有测式)
Sql = "Select
Distinct
字段名 from 数据表"
Distinct函数,查询数据库存表内不重复的记录
......
<!--#include file="conn.asp"-->
<%
if request.Form("username")="" or request.form("password")="" then
response.Write("<script>alert('您好,不能为空
');location.href='index.html';</script>")
end if
%>
<%
di ......
1。深层次来说这不是asp.net 的问题,而是html form 的submit 按钮就是如何设计。
当你的光标焦点进入某个表单元素的时候,会激活该表单的第一个(
流布局顺从左到右,从上至下)
type=submit 的按钮(假如有),等待响应回车事件,并提交该form
你可以测试一下代码
<form action="">
<input type ="t ......
asp 中文乱码,asp access 乱码,asp 刷新后乱码,asp utf 8乱码,ajax 乱码 asp,asp 汉字乱码,asp乱码怎么办
用utf-8编码用在新的网站上,不想问题还真多,所以找了些文章,帖子,看了看,等下有用的就贴下面了。
今天,我开始把 CODEPAGE="936" 改成 CODEPAGE="65001"
把charset=gb2312改成 charset=utf-8
可是还是乱码 ......