1.asp ?文文件超级暴涨指标源码ļ??ϴ? Դ??
2.å
³äºASPç
§ççä¸ä¼
asp ?ļ??ϴ? Դ??
上传界面:
<table width="%" border="0" align="center" cellpadding="3" cellspacing="0" class="border">
<form name="form1" method="post" action="upfiles.asp" enctype="multipart/form-data">
<tr>
<td height="" valign="middle" align="center" colspan="2" class="Title"><strong>批量上传产品</strong></td>
</tr>
<form name="form1" method="post" action="upfiles.asp" enctype="multipart/form-data">
<tr class=CommonListTitle height="" bgcolor="#eeeeee">
<td height="" align="center" valign="middle" class="tdbg"> 文件上传
<input type="hidden" name="act" value="upload">
(提交后请稍等!)</td>
</tr>
<tr c>
<td height="" align="center" valign="middle" class="tdbg">
<script language="javascript">
function setid()
{
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='文件'+i+':<input type="file" name="file'+i+'" style="width:"><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<li> 上传个数:
<input name="upcount" type="text" value="1" size="">
<input name="Button" type="button" class="button" onClick="setid();" value="· 设定 ·">
</li>
</td>
</tr>
<tr bgcolor="#eeeeee">
<td align="center" valign="middle" class="tdbg" id="upid"> 文件1:
<input type="file" name="file1" style="width:" value=""></td>
</tr>
<tr bgcolor="#eeeeee">
<td height="" align="center" valign="middle" class="tdbg">
<input name="Submit" type="submit" class="button" value="· 提交 ·">
<input name="Submit2" type="reset" class="button" value="· 重执 ·"></td>
</tr>
</form>
</table>
upfiles.asp 上传结果:
<%
dim conn,mypath
set conn=server.createobject("adodb.connection")
mypath=server.mappath("../../database/global.asa") '建立数据库连接.
conn.open "provider=microsoft.jet.oledb.4.0;data source=" & mypath
%>
<!--#include FILE="upload_5xsoft.inc"-->
<html>
<head>
<title>photo</title>
<link href="../style/style.css" rel="stylesheet" type="text/css">
<meta /dataä¸è½½ï¼ï¼å©ç¨å®å°±å¯ä»¥å¨ASPä¸ç´æ¥å®ç°æ件ä¸ä¼ åè½ãä¸é¢ï¼æ们就ä»ç»å ¶å®ç°è¿ç¨ã
1ï¼æå¼STREAM对象
对äºSREAM对象èè¨ï¼è¥è¦è¿è¡æ件çä¿åï¼åå¿ é¡»æ¯å°è¯¥å¯¹è±¡çå ¨é¨å 容è¿è¡ä¿åãå æ¤ï¼æä»¬å¿ é¡»è¦å建两个ï¼æå¤ä¸ªï¼STREAM对象ï¼å ¶ä¸ä¸ä¸ªä¸ºæºæ°æ®æµï¼å³æ¥æ¶åå§çäºè¿å¶æ°æ®ï¼å¦ä¸ä¸ªä¸ºç®çæ°æ®æµï¼å³æ¥æ¶æ¥èªç»æºæ°æ®æµå¤çåçæ°æ®ï¼å¹¶æç»ä¿å为æéçæ件ã
ï¼%
set str=server.CreateObject("ADODB.Stream") 'str为æºæ°æ®æµ
str.Mode=3 '设置æå¼æ¨¡å¼ï¼3为å¯è¯»å¯å
str.Type=1 '设置æ°æ®ç±»åï¼1为äºè¿å¶æ°æ®
str.Open
set desc=server.CreateObject("ADODB.Stream") 'desc为ç®æ æ°æ®æµ
desc.Mode=3
Desc.Type=1
desc.Open
%ï¼
2ï¼STEAM对象é´å 容çå¤å¶
å¨è¯¥é¨åï¼å¿ é¡»å¨æºæ°æ®æµä¸å®ä½æ件å¼å§çä½ç½®ï¼å¹¶ä¸æ±åºæ件å 容çé¿åº¦ï¼æè½å°æ件æ£ç¡®çå¤å¶å°ç®çæ°æ®æµä¸ï¼å¹¶ä¸ä¿åæ件ï¼ç¨åºä»£ç å¦ä¸ï¼
ï¼%
formdata=Request.BinaryRead(Request.TotalBytes) 'formdata为ä¸ä¼ çææå 容
str.Write formdata ' èµå¼æºæ°æ®æµ
str.position=count-lenb(result)-2 'positionæåºæ件çå¼å§ä½ç½®
str.copyto desc, lenb(filecotent) 'lenb(filecontent)表示æ件çé¿åº¦
desc.SaveToFile fullpath,2 '以fullpathæå®çè·¯å¾åå称ä¿åæ件
%ï¼
3ï¼å ³éSTEAM对象
ç¼ç¨å®æåï¼åºå ³é并éæ¾STEAM对象ï¼å¦ä¸æ示ï¼
ï¼%
Desc. Close
Set desc=nothing
Str. Close
Set STR=nothing
%ï¼
æ»ç»
æ¬æç»åºäºå©ç¨ASPç´æ¥å®ç°æ件ä¸ä¼ çæ¹æ³ï¼å¨æ¬åä½èªè¡å¼åçä¿¡æ¯ç®¡çç³»ç»ä¸å¾å°äºå¾å¥½çåºç¨ãå®è·µè¯æï¼ä¸ä¼ ç»çå ç§æ件ä¸ä¼ æ¹æ³ç¸æ¯ï¼è¯¥æ¹æ³æ´ç®ä¾¿ãæ´é«æã