savefiles.asp

来自「绿叶oa系统办公自动化 2008.工作日志管理,文件管理」· ASP 代码 · 共 94 行

ASP
94
字号
<!--#include file="connect.asp"-->
<!-- #include file="Upload.asp" -->
<!--#include file="../../../Connections/oavbsconn.asp" -->

<%
  Server.ScriptTimeout = 9999
  set Upload = new DoteyUpload

  Upload.MaxTotalBytes = 999999999999999999999999 *1024 *1024	' 最大10MB
  If Request.TotalBytes > 999999999999999999999999 *1024 *1024 Then
	Response.Write "<script>alert(""不要上传超过1GB的文件"");</script>"
  End If 
  Upload.ProgressID = Request.QueryString("ProgressID")
  dim path
    path="../../../dataandfiles/files/tz/"
  Dim objFSO1
  Set objFSO1= Server.CreateObject("Scripting.FileSystemObject")
  If  objFSO1.FolderExists(Server.MapPath(path))   Then   
Else   
objFSO1.CreateFolder(Server.MapPath(path))
Set objFSO1 = Nothing
End   If   
  dim path1
    path1="../../../dataandfiles/files/tz/"&session("bumen")&"/"
  Dim objFSO11
  Set objFSO11= Server.CreateObject("Scripting.FileSystemObject")
  If  objFSO11.FolderExists(Server.MapPath(path1))   Then   
Else   
objFSO11.CreateFolder(Server.MapPath(path1))
Set objFSO11 = Nothing
End   If%>


<%
Dim testfname__MMColParam
testfname__MMColParam = "1"
If (fp <> "") Then 
  testfname__MMColParam = fp
End If
%>
<%
Dim testfname
Dim testfname_numRows
Set testfname = Server.CreateObject("ADODB.Recordset")
testfname.ActiveConnection = MM_oavbsconn_STRING
testfname.Source = "SELECT ID  FROM 通知附件db  WHERE 文件路径 = '" + Replace(testfname__MMColParam, "'", "''") + "'"
testfname.CursorType = 0
testfname.CursorLocation = 2
testfname.LockType = 1
testfname.Open()
testfname_numRows = 0
%>
<%if not testfname.eof or not testfname.bof then
response.redirect("../gw/wrong.asp")
response.end()
end if
%>
<%
  Set UploadRequest = CreateObject("Scripting.Dictionary")
    dim upload,file,formName,formPath,iCount
  for each File in Upload.Files.Items
Sql = "insert into 通知附件db (文件名,文件路径,文件大小,发送人帐号,发送人姓名,发送人部门) values"
        Sql = Sql& " ('"& File.FileName &"','"& fp &"','"& fdaxiao &"','"& Session("userssdfgfhtrh") &"','"& Session("names") &"','"& Session("bumen") &"')"
 conn.execute(sql)
next%>
<%
  Upload.SaveTo(path1)
  if Upload.ErrMsg <> "" then 
    Response.Write(Upload.ErrMsg)
    Response.End()
  end if
  if Upload.Files.Count > 0 then
	Items = Upload.Files.Items
  end if
  for each File in Upload.Files.Items
  dim fp
fp=path1&File.FileName
session("fnames")=File.FileName
	%>
<%
  Response.Write("您已上传 " & Upload.Files.Count & " 个文件到: " & path & "<hr>")
%>
<%
 Response.Write("文件名: " & File.FileName & "<br>")
  Response.Write("文件大小: " & File.FileSize/1024 & " KB<br>")
   Response.Write("文件类型: " & File.FileType & "<br>")
  Response.Write("客户端路径: " & File.FilePath & "<br>")
  Response.Write("<hr>")
 Response.Write("<br>")
   response.write file.FilePath  & " (" & file.FileType & "/" & file.FileSize/1024 &"K) => <a target=_blank href='" & path1 & File.NewFileName & "'>" & formPath & File.FileName & "</a> 成功!<br>"
  response.write "<br /><BR>"
  fdaxiao=File.FileSize/1024&"kb"
%><%next%>

⌨️ 快捷键说明

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