Program | upload | text box Contact ASP also have nearly a year time, always want to talk about their own experience. Just today the unit work is not busy, I wrote my own multi-file multiple text box at the same time submitted to the server's pure ASP upload program, published. Hope to share with you.
The program is divided into three parts:
1, the storage file path, file description, upload file number of a database aaa.mdb, where I put in the application directory MyDatabase folder
2, upload the program interface gjimg.asp
3, the pure ASP uploads the main program khimg.asp uploads the file to store in the upload folder
+====================================================
Database Aaa.mdb
Table Tpic
Field type
ID Automatic
The absolute path of the Picpath field to store files in the server
Piccou Field stores the first few files of this upload
Pictxt field Save text description of File
Each row of the table stores a file and its text description
+=====================================================
The following code is the upload interface gjimg.asp
Affirm: This interface is I from a friend called "the Red", but she did not provide upload code, I based on her interface to write the upload main program.
-------------------------------------------------------------------
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Submission Picture upload </title>
<script language= "JavaScript" >
function SetID ()
{if (!window.form11.imgcou.value)
window.form11.imgcou.value=1;
Aa=window.form11.imgcou.value;
if (aa>100)//limited to 100 files
{aa=100;
window.form11.imgcou.value=100;
}
Str1= '
for (j=1;j<=aa;j++)
str1+= ' <br> <font color= "#003333" size= "2" id= "Shuang" > Picture ' +j+ ': </font><input name= "file ' +j+ '" Type= "File" class= "Xian" style= "height:20;width:221;" ><br> <font color= "#003333" size= "2" > Picture description ' +j+ ':</font> <input name= "txt ' +j+ '" "type=" text " Class= "Xian" style= "height:20;width:200;" > <br><br> ';
WINDOW.IMGID.INNERHTML=STR1;
}
</script>
<body >
<center>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
<TD height= "colspan=" 2 "align=" center "><font color=" #FF0000 "size=" 2 "><%=session (" ERRMESS11 ")% ></font></td>
</tr>
<tr>
<TD width= "67%" height= "align=" right "><font color=" #003333 "size=" 2 "> Please enter the number of photos uploaded:</font>
</td>
<TD width= "33%" height= "" align= "left" > <form "POST" method= "" action= "Name=" Form11 "id=" >
<input name= "Imgcou" id= "Imgcou" "type=" text "style=" HEIGHT:20;WIDTH:20; "class=" Xian ">
<input name= "TSD" type= "button" value= "setting" 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" > Picture 1:</ Font>
<input name= "file1" type= "file" class= "Xian" style= "height:20;width:221"; >
<br> <font color= "#003333" size= "2" > Picture description 1:</font> <input name= "txt1" type= "text" class= "Xian" Style= "HEIGHT:20;WIDTH:200;" >
<br></td>
</tr>
<tr>
<TD align= "center" height= "></td>"
<TD align= "left" ><input type= "Submit" Name= "FMDJ" "value=" submitted "style=" HEIGHT:20;WIDTH:40; "class=" Xian ">
<input type= "reset" name= "Submit2" value= "Reset style=" HEIGHT:20;WIDTH:40; "class=" Xian "></td>
</tr>
</form>
</table>
</center>
</body>
+========================================================================
To