?? upfile.asp
字號:
<!--#include file="config.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/UploadCls.Asp"-->
<%
Server.ScriptTimeOut = 18000
Dim UploadObject,AllowFileSize,AllowFileExt
Dim sUploadDir,SaveFileName,PathFileName,FileExtName
Dim sAction,sType,AutoRename
UploadObject = CInt(Newasp.UploadClass) '上傳文件對象 --- 0=無組件上傳,1=Aspupload3.0組件,2=SA-FileUp 4.0組件
AllowFileSize = CLng(Newasp.UploadFileSize * 1024 )
AllowFileExt = Newasp.UploadFileType
AllowFileExt = Replace(Replace(Replace(UCase(AllowFileExt), "ASP", ""), "ASPX", ""), "|", ",")
If Newasp.CheckPost=False Then
Call Returnerr(Postmsg)
Response.End
End If
Select Case ChannelID
Case 0
sUploadDir = Newasp.InstallDir & "UploadFile/"
Case Else
sUploadDir = Newasp.InstallDir & Newasp.ChannelDir & "UploadFile/"
End Select
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name=keywords content="新云網絡,新云論壇,新云下載,newasp.net,dnsxy.com">
<meta name="description" content="Design By www.Newasp.com">
<title>文件上傳</title>
<LINK href="style.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></head>
<body leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>
<table style="width:100%;height:100%" border="0" cellspacing="0" cellpadding="3" align=center>
<tr vAlign=top>
<td class=TableRow1>
<%
sAction = UCase(Trim(Request.QueryString("action")))
If sAction = "SAVE" Then
If CInt(Newasp.StopUpload) = 1 Then
Response.Write ("<script>alert('對不起!本頻道未開放上傳功能!');history.go(-1)</script>")
Response.End
End If
If CInt(GroupSetting(20)) <> 1 Then
Response.Write ("<script>alert('對不起!您沒有上傳文件的權限');history.go(-1)</script>")
Response.End
End If
If CLng(UserToday(1)) => CLng(GroupSetting(21)) Then
Response.Write ("<script>alert('對不起!您每天只能上傳" & GroupSetting(21) & "個文件。');history.go(-1)</script>")
Response.End
End If
Select Case UploadObject
Case 0,1,2,3
Call UploadFile
Case 999
Response.Write ("<script>alert('本系統(tǒng)未開放上傳功能!');history.go(-1)</script>")
Response.End
Case Else
Response.Write ("<script>alert('本系統(tǒng)未開放上傳功能!');history.go(-1)</script>")
Response.End
End Select
Dim strUserToday
strUserToday = UserToday(0) &","& UserToday(1)+1 &","& UserToday(2) &","& UserToday(3) &","& UserToday(4) &","& UserToday(5)
UpdateUserToday(strUserToday)
PathFileName = SaveFileName
'Call OutScript(PathFileName)
%>
<script language=javascript>
parent.document.myform.filePath.value='<%=PathFileName%>';
</script>
<input type=text name=file1 size=60 value='<%=PathFileName%>'> <input type="button" name="Submit4" onclick="javascript:history.go(-1)" value="繼續(xù)上傳文件" class=Button><br>
<font color=blue>請把地址復制到相應的輸入框</font>
<%
Else
Dim PostRanNum
Randomize
PostRanNum = Int(900*rnd)+1000
Session("uploadfile") = Cstr(PostRanNum)
%>
<table border="0" cellspacing="0" cellpadding="0">
<form action='?action=save&ChannelID=<%=ChannelID%>' method=post name=myform enctype="multipart/form-data">
<tr>
<td align="center" noWrap>
<INPUT TYPE="hidden" name="uploadfile" value="<%=PostRanNum%>">
<input type="file" name="file1" size=45>
<input type="submit" name="Submit" value="開始上傳">
<input type="checkbox" name="Rename" value='1'> 不自動更名
</td>
</tr><tr vAlign=top><TD colspan=4 class=TableRow1 valign=top>
允許上傳的文件類型:<%=AllowFileExt%> 大小:<font color=red><B><%=CStr(Newasp.UploadFileSize)%></B></font> KB<br>
您今天還可以上傳<font color=red><B><%=CLng(GroupSetting(21)) - CLng(UserToday(1)) %></B></font>個文件</td></td>
</tr></form></table>
<%
End If
%>
</td>
</tr></table>
</body>
</html>
<%
Sub UploadFile()
Dim Upload,FilePath,sFilePath,FormName,File
sFilePath = CreatePath(sUploadDir) '按日期生成目錄
FilePath = sUploadDir & sFilePath
Set Upload = New UpFile_Cls
Upload.UploadType = UploadObject '設置上傳組件類型
Upload.UploadPath = FilePath '設置上傳路徑
Upload.MaxSize = AllowFileSize '單位 KB
Upload.InceptMaxFile = 10 '每次上傳文件個數(shù)上限
Upload.InceptFileType = AllowFileExt '設置上傳文件限制
Upload.ChkSessionName = "uploadfile"
'執(zhí)行上傳
Upload.SaveUpFile
If Upload.ErrCodes<>0 Then
Response.write ("<script>alert('錯誤:"& Upload.Description & "');history.go(-1)</script>")
Exit Sub
End If
If Upload.Count > 0 Then
For Each FormName In Upload.UploadFiles
Set File = Upload.UploadFiles(FormName)
SaveFileName = FilePath & File.FileName
Set File = Nothing
Next
Call OutFilesize(Upload.MaxSize)
Else
Response.Write ("<script>alert('^_^哥們!請選擇一個有效的上傳文件!');history.go(-1)</script>")
Exit Sub
End If
Set Upload = Nothing
End Sub
Sub OutFilesize(filesize)
Response.Write "<script language=javascript>" & vbCrLf
Response.Write "parent.document.myform.filesize.value='" & Round(filesize/1024,2) & "';" & vbCrLf
Response.Write "</script>" & vbCrLf
End Sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -