📄 addattachdo.asp
字号:
<!--#include virtual="include/DataEnvi.asp"-->
<!--#include virtual="include/function.asp"-->
<%
Dim RootPath
Dim BasePath
Dim KeyPath
Dim FileFold
Dim ObjFS
Dim IDs
Dim StrFileName,Source
Dim ObjDB,ObjRS,StrSQL,FilePath
Set ObjFS = Server.CreateObject("Scripting.FileSystemObject")
Set ObjUpload = Server.CreateObject("LyfUpload.UploadFile")
RootPath = "Files"
BasePath = ObjUpload.Request("BasePath")
IDs = ObjUpload.Request("IDs")
If BasePath = "" Then BasePath = "Default"
FileFold= Server.MapPath(RootPath&"/"&BasePath)
If Not ObjFS.FolderExists(FileFold) Then
ObjFS.CreateFolder(FileFold)
End If
Randomize
KeyPath = Year(Date()) & Month(Date()) & Day(Date())
KeyPath = KeyPath & Hour(Time()) & Minute(Time()) & Second(Time())
KeyPath = KeyPath & (20000-Cint(10000*Rnd))
FileFold = Server.MapPath(RootPath&"/"&BasePath&"/"&KeyPath)
If Not ObjFS.FolderExists(FileFold) Then
ObjFS.CreateFolder(FileFold)
End If
'Response.Write FileFold
'Response.End
StrFileName = ObjUpload.SaveFile("source",FileFold,true) '保存文件到服务器
IntFileSize = ObjUpload.FileSize
If StrFileName = "" Then
StrErr = "文件上传失败!"
ElseIf StrFileName = "1" Then
StrErr = "文件尺寸过大!"
ElseIf StrFileName = "0" Then
StrErr = "上传文件类型不正确!"
End if
If StrErr <> "" Then
ObjFS.DeleteFolder(FileFold)
Response.Write StrErr & "<input type=button value='返回' onclick='window.close()'>"
Response.End
End If
Set ObjDB = Server.CreateObject("Adodb.Connection")
OpenDB ObjDB
StrSQL = "Insert Into t_OA_Attach (FileName,FileSize,BasePath,KeyPath,AccountID) Values ('" & StrFileName & "','" & IntFileSize & "','" & BasePath & "','" & KeyPath & "','" & Session("AccountID") & "')"
ObjDB.Execute StrSQL
StrSQL = "Select Top 1 ID From t_OA_Attach Order By ID Desc"
Set ObjRS = ObjDB.Execute(StrSQL)
IntID = ObjRS("ID")
If IDs="" Then
IDs = KeyPath
Else
IDs = IDs & "," & KeyPath
End If
Response.Redirect "AddNew.asp?IDs=" & IDs & "&BasePath=" & BasePath
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -