📄 addattachdo0.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
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
StrFileName = ObjUpload.SaveFile("source",FileFold,true) '保存文件到服务器
IntFileSize = ObjUpload.FileSize
If StrFileName = "" Then
StrErr = "文件上传失败!"
ElseIf StrFileName = "0" Then
StrErr = "文件尺寸过大!"
End if
If StrErr <> "" Then
ObjFS.DeleteFolder(FileFold)
Response.Write StrErr & "<input type=button value='返回' onclick='javascript:history.go(-1)'>"
Response.End
End If
Set ObjDB = Server.CreateObject("Adodb.Connection")
OpenDBH ObjDB
StrSQL = "Insert Into t_Hrms_Attach (FileName,FileSize,BasePath,KeyPath,AccountID) Values ('" & StrFileName & "','" & IntFileSize & "','" & BasePath & "','" & KeyPath & "','" & Session("AccountID") & "')"
ObjDB.Execute StrSQL
ObjDB.close
set ObjDB=nothing
'-------------------------------------------------------------------------------
'在操作完OA中的t_Hrms_Attach表中的记录后马上修改Kingcrm库中t_crm_Bargain表中相应的记录
if (Session("Table_id")<>"") Then
Set ObjDB = Server.CreateObject("Adodb.Connection")
OpenDBH ObjDB
set ObjRS=Server.CreateObject("Adodb.recordset")
StrSql= "Select * From "&Session("TableName")&" Where ID= "&Cint(Session("Table_id"))
ObjRS.Open StrSql,ObjDB,1,3
dim aa
aa=ObjRS("Attachs")
ObjRS("Attachs")=aa&","&KeyPath
ObjRS.Update
ObjRS.Close
Set ObjRS=Nothing
ObjDB.Close
Set ObjDB=Nothing
End if
'--------------------------------------------------------------------------------
Set ObjDB = Server.CreateObject("Adodb.Connection")
OpenDBH ObjDB
StrSQL = "Select Top 1 ID From t_Hrms_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 + -