无组件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
相关文档:
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from 0791idc_News where BigClassName='家装课堂' order by ID desc"
rs.Open sql,Conn,1,1
if rs.eof and rs.bof then
response.Write("暂时没有记录")
else
%>
......
IIS默认的错误页是很不友好的,很多人看到默认的错误页时都会说:网站打不开了!白白损失了这部分流量。而如果错误页直接跳转到首页又对搜索引擎很不友好,搞不好首页还会被封掉。所以根据情况,有两个方法解决这个问题:
如果是博客等内容型的网站,可以返回一个带有404错误的搜索框让访客搜索,若是电子商务型网站 ......
ASP系列函数大全-网上收集的一些ASP函数及表达式
ASP函数
大全
ASP函数与VBSCRIPT类似,以下举一些常用的函数
Array()
函数返回一个数组
表达式 Array(list)
允许数据类型: 字符,数字均可
实例: <%
Dim
myArray()
For i = 1 to 7
Redim Preser ......
1。深层次来说这不是asp.net 的问题,而是html form 的submit 按钮就是如何设计。
当你的光标焦点进入某个表单元素的时候,会激活该表单的第一个(
流布局顺从左到右,从上至下)
type=submit 的按钮(假如有),等待响应回车事件,并提交该form
你可以测试一下代码
<form action="">
<input type ="t ......
'SQL防注入函数,调用方法,在需要防注入的地方替换以前的request("XXXX")为SafeRequest("XXXX")
'www.yongfa365.com
Function
SafeRequest(ParaValue)
ParaValue =
Trim
(
Request
(Pa ......