多檔案多文字框上傳程式

來源:互聯網
上載者:User
程式|上傳|文字框 接觸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></td>
</tr>
<tr>
<td align="center" height="30" ></td>
<td align="left" ><input type="submit" name="FMDJ" value="提交" style="height:20;width:40;" class="xian">
<input type="reset" name="Submit2" value="重設" style="height:20;width:40;" class="xian"></td>
</tr>
</form>
</table>
</center>
</body>
</html>

+========================================================================



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.