⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xxupload.asp

📁 金路网络硬盘====特首快传系统 (Tso upload system 1.0) 使用ASP脚本编写,大量使用类封装,全面集成优化aspuplaod3.0批量上传
💻 ASP
字号:
<!--#include file="../Conn.asp" -->
<!--#include file="Inc.asp" -->
<script language="javascript">
function xu_check()
{
	var obj = xu_find();
	if (obj != null)
	{
		var str = form1.textbox1.value;
		if (str.indexOf(":") > 0) // 检查是否已经上传过文件
		{
			xu_subpath(form1.subpath.value);
			str = obj.uploadfile();
		}
		if (str != "") return true;
	}
	return false;
}
</script>
<style type="text/css">
<!--
body {
	margin-left: 5px;
}
-->
</style><body bgcolor="#F4F3F3">
<%
dim server_v1,server_v2
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write "<script>window.alert(""你提交的路径有误,禁止从站点外部提交数据!"");window.top.location='../Upload.asp';</script>"
response.end
end if
If Session("UserId")="" Then
response.write "<script>window.alert(""登陆超时,请重新登陆!"");window.top.location='../Login.asp';</script>"
Response.End
End If
createdir(replace(Request.ServerVariables("PATH_TRANSLATED"),"Include\XXupload.asp","")&"UpLoadFiles\"&Year(date)&Month(date))   
function   CreateDIR(byval   LocalPath)   '建立目录的程序,如果有多级目录,则一级一级的创建     
  on   error   resume   next     
  LocalPath   =   replace(LocalPath,"\","/")     
  set   FileObject   =   server.createobject("Scripting.FileSystemObject")     
  patharr   =   split(LocalPath,"/")     
  path_level   =   ubound(patharr)     
  for   i   =   0   to   path_level     
  if   i=0   then   pathtmp=patharr(0)   &   "/"   else   pathtmp   =   pathtmp   &   patharr(i)   &   "/"     
  cpath   =   left(pathtmp,len(pathtmp)-1)     
  if   not   FileObject.FolderExists(cpath)   then   FileObject.CreateFolder   cpath     
  next     
  set   FileObject   =   nothing     
  if   err.number<>0   then     
  CreateDIR   =   false     
  err.Clear     
  else     
  CreateDIR   =   true     
  end   if     
  end   function 
 %>
<form name="form1" method="post" action="XXupload.asp" onSubmit="return xu_check();" id="form1">
	<blockquote><table width="90%" align="center">
      <tr>
        <th height="25" scope="col">					   
					  <span style="DISPLAY: none">
						<object id="uploadid" classid="clsid:18B9E4BF-F21F-46B9-AD50-5CA62145426A" codebase="../kongjian/xupload.rar">
							<param name="Action" value="<%=replace(Request.ServerVariables("PATH_INFO"),"XXupload.asp","xu_upload.asp")%>">
							<param name="Bind" value="textbox1">
						</object>
		  </span>
						<script language="javascript" src="xuploadfiles.js"></script>
						<input name="textfield" type="text" size="72" >
		<input onClick="xu_selectfiles();" type="button" style="border: 1px solid #BABABA; padding-top: 1; padding-bottom: 1; background-color: #F5F5F5" value="浏览..." /></th>
      </tr>
      <tr>
        <td height="120" align="center" ><textarea name="textbox1" rows="7" cols="81" wrap="off" readonly="readonly" id="textbox1" style="OVERFLOW-X: hidden">可按住Ctrl选择多个文件上传....</textarea></td>
      </tr>
      <tr>
        <td height="25" align="center"><input type="submit" name="ok" style="border: 1px solid #BABABA; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #F5F5F5" value=" 上 传 文 件 " id="ok" /><input type="hidden" name="subpath" id="subpath" value="<%=Year(date)&Month(date)%>"></td>
      </tr>
    </table></blockquote>
</form>
<%
If Request.Form("textbox1") <> "" Then
	Dim Irs,Isql,F_Ext,F_Type
	namearray = Split(Request.Form("textbox1"),vbLf) ' 多个文件名之间使用换行符(vbLf)分割
	count = UBound(namearray)
	For i = 0 To count
		fileinfo = Split(namearray(i),"#") ' 文件信息格式:文件名#文件类型#文件大小
		countinfo = UBound(fileinfo) + 1
		F_Ext=replace(fileinfo(1),left(fileinfo(1),Instr(fileinfo(1),".")),"")
		If F_Ext="jpg" or F_Ext="jpeg" or F_Ext="gif" or F_Ext="bmp" or F_Ext="png" or F_Ext="tif" or F_Ext="iff" Then
		F_Type=1
		ElseIF F_Ext="swf" or F_Ext="swi" Then
		F_Type=2
		ElseIF F_Ext="mp3" or F_Ext="m3u" or F_Ext="wav" or F_Ext="wma" or F_Ext="wax" or F_Ext="asx" or F_Ext="asf" or F_Ext="mp2" or F_Ext="au" or F_Ext="aif" or F_Ext="aiff" or F_Ext="mid" or F_Ext="midi" or F_Ext="rmi" Then
		F_Type=3
		ElseIF F_Ext="rm" or F_Ext="rmvb" or F_Ext="ram" or F_Ext="ra" or F_Ext="mov" Then
		F_Type=4
		ELSEIF F_Ext="mpg" or F_Ext="mpeg" or F_Ext="mpv" or F_Ext="mps" or F_Ext="m2v" or F_Ext="m1v" or F_Ext="mpe" or F_Ext="mpa" or F_Ext="avi" or F_Ext="wmv" or F_Ext="wm" or F_Ext="wmx" or F_Ext="wvx" Then
		F_Type=5
		ElSEIF F_Ext="asa" or F_Ext="asp" or F_Ext="bat" or F_Ext="cmd" or F_Ext="code" or F_Ext="com" or F_Ext="db" or F_Ext="dll" or F_Ext="doc" or F_Ext="exe" or F_Ext="fla" or F_Ext="ftp" or F_Ext="h" or F_Ext="hlp" or F_Ext="htm" or F_Ext="html" or F_Ext="inc" or F_Ext="info" or F_Ext="ini" or F_Ext="js" or F_Ext="log" or F_Ext="mdb" or F_Ext="pdf" or F_Ext="php" or F_Ext="pic" or F_Ext="ppt" or F_Ext="rar" or F_Ext="real" or F_Ext="torrent" or F_Ext="txt" or F_Ext="xls" or F_Ext="xml" or F_Ext="zip" Then
		F_Type=6
		End If
		Set IRs = Server.CreateObject("ADODB.Recordset")
		ISql="select * from [Tso_FilesList]"
		IRs.open ISql,conn,3,3
		IRs.addnew
		IRs("F_Type")=F_Type
		IRs("F_Ext")=F_Ext
		IRs("F_Path")=replace(fileinfo(2),"\","/")
		IRs("F_ContentType")=fileinfo(3)
		IRs("F_Size")=fileinfo(4)
		IRs("F_GetFileId")=replace(replace(replace(replace(replace(now,"-",""),":",""),"上午",""),"下午","")," ","")&fileinfo(0)
		IRs("F_AddTime")=now
		IRs("F_UserIp")=request.serverVariables("REMOTE_ADDR")
		IRs("F_UserID")=Session("UserId")
		IRs("F_Title")=fileinfo(1)
		IRs("F_Titles")="无备注信息"	
		IRs.update
		IRs.Close
		Set IRs=Nothing
	Next
	response.write "<script>window.alert(""成功上传 " & (count + 1) & " 个文件!"");window.top.location='../Myfiles.asp';</script>"
End If
%>
</body>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -