asp 连接数据库代码实例
<form name="form" method="post" action="?action=add" onsubmit="return chkform(this)">
<input name="picurl" type="text" id="picurl" size="20">
<iframe name="I1" width="155" height="25" src="upsoftpic.asp" scrolling="no" border="0" frameborder="0">浏览器不支持嵌入式框架,或被配置为不显示嵌入式框架。</iframe>
</form>
upsoftpic.asp
<form action="Upfile.asp?action=upsoftpic" method="POST" enctype="multipart/form-data" class="fontmenu2" onsubmit="up.disabled=true;up.value='上传中,请稍候……'">
<input name="softpic" type="file" class="fontmenu2" size="1">
<input type="submit" value="上传" name="up" >
</form>
upfile.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Server.ScriptTimeout=999%>
<!--#include file="Conn.asp"-->
<!--#include file="Upload.asp" -->
<!-- 上传软件或者图片开始 -->
<%
if request("action")="upsoftpic" then
set upload=new upload_5xsoft
set file=upload.file("softpic")
fileExt=lcase(right(file.filename,4))
if fileEXT<>".jpg" and fileEXT<>".gif" and fileEXT<>".rar" then '---设置上传类型 ++++fileEXT<>".***"++++++++
response.write"<script>alert('格式不对,请重新上传!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
if file.fileSize>0 then
formPath="upfile/softpic" '-------上传路径
'formPath="../upfile/softpic"
if right(formPath,1)<>"/" then
formPath=formPath&"/"