asp怎样上传文件到指定的文件夹,并在access中记录路径
想上传文件到指定的文件夹,并在access中记录路径,在asp页面中显示所上传的软件,点击直接下载功能。
注意:是上传文件,不是图片。文件包括exe、rar、zip、doc、jpg等等。
最佳答案上传文件页 index.asp 开始
-----------------------------
index.asp 代码如下
<SCRIPT language=JavaScript type=text/javascript>
function a(htmlurl) {
var win = window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,height=10,left=380,top=380");
}
</SCRIPT>
<form name="zc" action="index.asp" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td height="30" align="right" >汽车照片: </td>
<td><input type="text" name="qczp" class="zc_input" maxlength="100" value="<%=session("qczp")%>" readonly></td>
<td bgcolor="#E7F8F8" ><input type="button" value="上传图片" onClick="a('uploadprod.asp');" name="button" ></td>
</tr>
</form>
</table>
上传文件页 index.asp 结束
-----------------------------
uploadprod.asp 选择图片上传 开始
-----------------------------
uploadprod.asp 代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上传图片</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script>
function check()
{
var mf=document.up;
if (mf.image.value.length<4)
{
alert("请选择需要上传的图片.");
mf.image.focus();
return false;
}
return true;
}
</script>
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
urnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
inputtypefile不上传文件 return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
urnValue = false;
return false;
}
}
extmenu = nocontextmenu; // for IE5+
usedown = norightclick; // for all others
</script>
</head>
<body onselectstart="return false" oncopy="return false" oncut="return false" onpaste="return false" oncontextmenu="return false">
<%
response.buffer=true
const page_level=1
%>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" align="center" height="25" >上传图片</td>
</tr>
<form name="up" method="post" action="uploadprod2.asp" enctype="multipart/form-data" onsubmit='return check();'>
<tr>
<td width="50%" align="right" height="25">选择图片:</td>
<td width="50%"><input type="file" name="image" ></td>
</tr>
<tr>
<td colspan="2" height="25" align="center"><input type="submit" value="提 交" name="Submit" >
<input type="reset" value="重 置" ></td>
</tr>
</form>
</table>
</body>
</html>
上传文件页 uploadprod.asp 结束
-----------------------------
判断文件以及文件是否存在则上传 uploadprod2.asp 开始
-----------------------------
uploadprod2.asp 源代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片上传</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
urnValue = false;
return false;
}
function norightclick(e)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论