接触ASP也有将近一年时间,总想说一下自己的心得。正好今天单位工作不忙,我把我自己编写的多文件多文本框同时提交到服务器的纯ASP上传程序整理了一下,发表出来。希望与大家共同交流。
程序分为三部分:
1、储存文件路径、文件说明、上传文件个数的一个数据库aaa.mdb,在这里我放在应用目录里mydatabase文件夹里
2、上传程序界面  gjimg.asp
3、纯ASP上传主程序 khimg.asp 上传文件存放在upload文件夹里
+====================================================
数据库aaa.mdb
表TPIC
字段                类型
ID                    自动
PICPATH        字段          储存文件的在服务器的绝对路径
PICCOU        字段            储存这次上传的第几个文件
PICTXT          字段            储存文件的文字说明
表的每一行储存一个文件和它的文字说明
+=====================================================
以下代码是上传界面  gjimg.asp
申明一下:这个界面是我从一个叫“红涯”的网友那里得到,不过她没有提供上传代码,我根据她的界面编写了上传主程序。
-------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投稿图片上传</title>
<script language="JavaScript">
function setid()
{  if(!window.form11.imgcou.value)
    window.form11.imgcou.value=1;
  aa=window.form11.imgcou.value;
  if (aa>100) //限制为100个文件
  {aa=100;
    window.form11.imgcou.value=100;
  }
  str1=''
  for(j=1;j<=aa;j++)
  str1+='<br> <font color="#003333" size="2" id="shuang">图片'+j+':</font><input name="file'+j+' " type="file" class="xian" style="height:20;width:221;"><br> <font color="#003333" size="2">图片说明'+j+':</font> <input name="txt'+j+'" type="text" class="xian" style="height:20;width:200;"> <br><br>';
  window.imgid.innerHTML=str1;
  }
</script>
</head>
<body >
<center>
<table width="100%" border="0" cellpadding="0" cellspacing="0">        
          <tr> 
            <td height="25" colspan="2" align="center"><font color="#FF0000" size="2"><%=session("errmess11")%></font></td>
          </tr>
          <tr> 
            <td width="67%" height="25" align="right" ><font color="#003333" size="2">请输入上传图片的张数:</font> 
            </td>
            <td width="33%" height="25" align="left" > <form method="post" action="" name="form11" id="form11">
                <input name="imgcou" id="imgcou" type="text" style="height:20;width:20;" class="xian">                  
                <input name="tsd" type="button" value="设定" style="height:20;width:50;" class="xian" onClick="setid();">
              </form></td>
          </tr>
          <form name="SCM" action="khimg.asp" method="post" enctype="multipart/form-data">
            <tr> 
              <td  colspan="2" align="center" id="imgid"><br> <font color="#003333" size="2" id="shuang">图片1:</font> 
                <input name="file1" type="file" class="xian" style="height:20;width:221;"> 
                <br> <font color="#003333" size="2">图片说明1:</font> <input name="txt1" type="text" class="xian" style="height:20;width:200;"> 
                <br>