谁有类似网络硬盘的功能的源码吗?

jiyi30215 2009-01-05 10:12:46
是要添加到ASP做的OA系统里,主要功能也是上传下载等
但还有一个要求是用户之间只能看见自己所建文档。
谁有源码吗,比较急,后面催得紧!!希望大家帮帮忙……
...全文
155 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lbcleo 2009-01-07
  • 打赏
  • 举报
回复
up
mingday 2009-01-05
  • 打赏
  • 举报
回复
加个上传、下载的功能就是了
用网络硬盘功能,有点夸张了。
jiyi30215 2009-01-05
  • 打赏
  • 举报
回复
好的。我先试试,谢谢了
明珠佩佩 2009-01-05
  • 打赏
  • 举报
回复
<script language=javascript>
function CheckFileData()
{

if(jtrim(document.FileUploads.File1.value)=="")
{
alert("请选择要上传的文件")
return false;
}

return true;
}
</script>
<script language=javascript src="../inc/jtrim.js"></script>
<script language="Javascript" src="functions.js"></script>
<!--#include file="../inc/Conn_close.asp"-->
<%

sub GetOneFolder(PersonalPath)
set objFileSystem=server.CreateObject("scripting.filesystemobject")
PersonalPath=Server.MapPath (PersonalPath)

if trim(PersonalPath)<>"" and objFileSystem.FolderExists(PersonalPath) then
Set f = objFileSystem.GetFolder(PersonalPath)
strParentFolder = f.ParentFolder
set f=nothing
set oSubFolder=objFilesystem.GetFolder(PersonalPath).SubFolders

for each FolderItem in oSubFolder

str = str & "<option value='"& UnMappath(folderitem.path) &"'"&">"& folderitem.name &"         <DIR><BR>"
next

set oFiles=objFilesystem.GetFolder(PersonalPath).files
for each FileItem in oFiles
str = str& "<option value='"& UnMappath(fileitem.path) &"'"&">" & fileitem.name &"   "&formatnumber(fileitem.size/1000,"2",-1,-1)&"Kb "& "   "&fileitem.DateLastModified &"<BR>"
next
else
Set f = objFileSystem.GetFile(PersonalPath)
strParentFolder = f.ParentFolder
set f=nothing
set objFileSystem=nothing
response.redirect "FileManager.asp?errmsg=1&nf="& UnMappath(strParentFolder)
end if
set objFileSystem=nothing
end sub

Private function getParentFolder(byval strPath)
set objFileSystem=server.CreateObject("scripting.filesystemobject")
strPath=Server.MapPath (strPath)

if trim(strPath)<>"" and objFileSystem.FileExists(strPath) then
Set f = objFileSystem.GetFile(strPath)
strParentFolder = f.ParentFolder
getParentFolder=UnMappath(strParentFolder)
set f=nothing
else
getParentFolder=RootDir
end if
end function

sub DeleteFiles(PersonalPath)
strFilePath=trim(PersonalPath)
PersonalPath=Server.Mappath(PersonalPath)
dim fs
Set fs = server.CreateObject("Scripting.FileSystemObject")
if trim(PersonalPath)<>"" and fs.FileExists(PersonalPath) then
fs.DeleteFile PersonalPath
oConn.execute "Delete tblFile where FilePath ='"& strFilePath &"' or FilePath ='"& ".."&strFilePath &"' or FilePath ='"& "../"&strFilePath &"'"
elseif trim(PersonalPath)<>"" and fs.FolderExists(PersonalPath) then
fs.DeleteFolder PersonalPath

strFilePath=strFilePath&"/"
oConn.execute "Delete tblFile where (FilePath like '%"& strFilePath &"%') and (FilePath<>'"& strFilePath &"')"

end if

set fs=nothing
end sub

sub RenameFiles(PersonalPath, NewName)
strFilePath=PersonalPath
strNewDir = ".."&getParentFolder(strFilePath)
PersonalPath=Server.Mappath(strFilePath)
dim fs
Set fs = server.CreateObject("Scripting.FileSystemObject")
if trim(PersonalPath)<>"" and fs.FileExists(PersonalPath) then
Set f = fs.GetFile(PersonalPath)
f.name = NewName
set f=nothing

oConn.execute "update tblFile set FilePath='"& strNewDir&"/"&NewName &"' where FilePath ='"& strFilePath &"' or FilePath='.."&strFilePath &"'"
elseif trim(PersonalPath)<>"" and fs.FolderExists(PersonalPath) then
Set f = fs.GetFolder(PersonalPath)
f.name = NewName
set f=nothing
end if

set fs=nothing
end sub

sub CreatDir(PersonalPath)
PersonalPath=Server.Mappath(PersonalPath)
dim fs
Set fs = server.CreateObject("Scripting.FileSystemObject")
if trim(PersonalPath)<>"" and fs.FolderExists(PersonalPath) then
response.redirect "FileManager.asp?errmsg=2&nf="& currentfolder
else
fs.CreateFolder PersonalPath
end if

set fs=nothing
end sub

sub MakeFiles(PersonalPath)
PersonalPath=Server.Mappath(PersonalPath)
dim fs
Set fs = server.CreateObject("Scripting.FileSystemObject")
if trim(PersonalPath)<>"" and fs.FileExists(PersonalPath) then
response.redirect "FileManager.asp?errmsg=3&nf="& currentfolder
else
fs.CreateTextFile PersonalPath
end if

set fs=nothing
end sub

Private Function UnMappath(byVal FullPath)
'take a mappath-ed directory and make it virtual
dim root, tmp1, tmp2
fullpath=lcase(fullpath)
root = lcase(server.mappath("/"))
'FullPath = FullPath
tmp1 = Replace(fullPath, root, "")
tmp2 = Replace(tmp1, "\", "/")
'if not right(tmp2, 1) = "/" then tmp2 = tmp2 & "/"
UnMappath = Trim(tmp2)
End Function

sub CheckRootDir(PersonalPath)
PersonalPath=Server.Mappath(PersonalPath)
Set fs = server.CreateObject("Scripting.FileSystemObject")
if trim(PersonalPath)<>"" and fs.FolderExists(PersonalPath) then
else
fs.CreateFolder PersonalPath
end if
set fs=nothing
end sub
%>
明珠佩佩 2009-01-05
  • 打赏
  • 举报
回复
<td valign="bottom" align="center">
<table border=0>
<tr height=30>
<td align="center"><input type="button" name="Open" value="打开选择的目录" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex))
opendir(document.mainform.fsel[document.mainform.fsel.selectedIndex].value)"></td>
</tr>
<tr height=30>
<td align="center">
<%if instr(RootDir,LoginID&"_")>1 or instr(RootDir,"/FileDir/Public")>0 then%>
<input type="button" name="Delete" value="删除" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) delfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">
<%elseif trim(RootDir)="../FileDir/"&LoginID or trim(RootDir)="/FileDir/"&LoginID then%>
<input type="button" name="Delete" value="删除" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) delfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">
<%else%>
<input type="button" name="Delete" value="删除" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) delfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);" disabled>

<%end if%>

<%if instr(RootDir,LoginID&"_")>1 or instr(RootDir,"/FileDir/Public")>0 then%>
<input type="button" value="重命名" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) renfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">
<%elseif trim(RootDir)="../FileDir/"&LoginID or trim(RootDir)="/FileDir/"&LoginID then%>
<input type="button" value="重命名" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) renfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">
<%else%>
<input type="button" value="重命名" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) renfile('<%=currentfolder%>',document.mainform.fsel[document.mainform.fsel.selectedIndex].value);" disabled>

<%end if%>

</td>
</tr>
<tr height=30>
<td align="center">
<%if instr(RootDir,LoginID&"_")>1 or instr(RootDir,"/FileDir/Public")>0 then%>
<input type="button" name="Create" value="创建目录" style='background:#336699' class='Font9BoldWhite' onClick="createdir('<%=currentfolder%>');">
<%elseif trim(RootDir)="../FileDir/"&LoginID or trim(RootDir)="/FileDir/"&LoginID then%>
<input type="button" name="Create" value="创建目录" style='background:#336699' class='Font9BoldWhite' onClick="createdir('<%=currentfolder%>');">
<%else%>
<input type="button" name="Create" value="创建目录" style='background:#336699' class='Font9BoldWhite' onClick="createdir('<%=currentfolder%>');" disabled>

<%end if%>

<input type="button" name="View" value="查看文件" style='background:#336699' class='Font9BoldWhite' onClick="if(checkSelected(document.mainform.fsel.selectedIndex)) viewfile(document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">

</td>
</tr>

</table><br></form>

<form method="post" name="FileUploads" enctype="multipart/form-data" action="FileUpload.asp?RootDir=<%=RootDir%>&FileUpFolder=<%=currentFolder%>">
<table border=0 cellpadding=3 cellspacing=1 bgcolor=#0047b0 width="100%">
<tr bgcolor=#ffffff><td><font color=red>提醒:如果您的文件是 Word、Excel、PowerPoint等文档建议压缩成 .zip文件再上传!</font>
</td></tr>
<tr bgcolor=#ffffff><td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td>文件:</td><td><input type="file" name="File1" size=20 class="input"></td>
</tr>
<tr>
<td>主题:</td><td><input type="text" name="Text1" size=20 maxlength=50 class="input"></td>
</tr>
</table>
</td></tr>

<tr bgcolor=#ffffff><td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td>文件:</td><td><input type="file" name="File2" size=20 class="input"></td>
</tr>
<tr>
<td>主题:</td><td><input type="text" name="Text2" size=20 maxlength=50 class="input"></td>
</tr>
</table>
</td></tr>

<tr bgcolor=#ffffff><td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td>文件:</td><td><input type="file" name="File3" size=20 class="input"></td>
</tr>

<tr>
<td>主题:</td><td><input type="text" name="Text3" size=20 maxlength=50 class="input"></td>
</tr>
</table>
</td></tr>
</table>

<%if instr(RootDir,LoginID&"_")>1 or instr(RootDir,"/FileDir/Public")>0 then%>
<INPUT TYPE="submit" name="cmdUp" value="执行文件上传" style='background:#336699' class='Font9BoldWhite' onClick="return CheckFileData();">
<%elseif trim(RootDir)="../FileDir/"&LoginID or trim(RootDir)="/FileDir/"&LoginID then%>
<INPUT TYPE="submit" name="cmdUp" value="执行文件上传" style='background:#336699' class='Font9BoldWhite' onClick="return CheckFileData();">
<%else%>
<INPUT TYPE="submit" name="cmdUp" value="执行文件上传" style='background:#336699' class='Font9BoldWhite' onClick="return CheckFileData();" disabled>

<%end if%>
</form>

</td>
</tr>

</table>
</div><BR>
</body>
</html>
明珠佩佩 2009-01-05
  • 打赏
  • 举报
回复
<HTML>
<HEAD>
<TITLE> File System Manager </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/main.css">
</HEAD>
<BODY topmargin=0 marginheight=0>
<form name=deleteform action='FileManager.asp' method=post>
<input type=hidden name=faction value=del>
<input type=hidden name=nf value="">
<input type=hidden name=fsel value="">
<input type=hidden name="RootDir" value="<%=RootDir%>">
</form>
<form name=renameform action='FileManager.asp' method=post>
<input type=hidden name=faction value=ren>
<input type=hidden name=nf value="">
<input type=hidden name=fsel value="">
<input type=hidden name=newname value="">
<input type=hidden name="RootDir" value="<%=RootDir%>">
</form>
<form name=cdir action='FileManager.asp' method=post>
<input type=hidden name=faction value=cdir>
<input type=hidden name=nf value="">
<input type=hidden name=newdir value="">
<input type=hidden name="RootDir" value="<%=RootDir%>">
</form>
<form name=makeonefiles action='FileManager.asp' method=post>
<input type=hidden name=faction value=makefiles>
<input type=hidden name=nf value="">
<input type=hidden name=newfile value="">
</form>
<form name=editform action='FileEdit.asp' method=post>
<input type=hidden name=faction value=editfile>
<input type=hidden name=file2edit value="">
</form>
<form name=viewfileform action='FileManagerViewFile.asp' method=post target="_blank">
<input type=hidden name=f2v value="">
</form>
<form name=writepermform action='FileManager.asp' method=post>
<input type=hidden name=faction value=mfilewrite>
<input type=hidden name=f2mwrite value="">
</form>
<form name=instexform action='FileManager.asp' method=post>
<input type=hidden name=faction value=installex>
<input type=hidden name=exnum value="">
<input type=hidden name="RootDir" value="<%=RootDir%>">
</form>
<form name="mainform" action='FileManager.asp' method=post>
<input type=hidden name=faction value=''>
<input type=hidden name=nf value=''>
<input type=hidden name="RootDir" value="<%=RootDir%>">

<div align="center">
<table border=0 width="98%">
<tr>
<td>
<%if errmsg="1" then
response.write "<font color=#ff0000>"& msginfo1 &"</font>"
elseif errmsg="2" then
response.write "<font color=#ff0000>"& msginfo2 &"</font>"
elseif errmsg="3" then
response.write "<font color=#ff0000>"& msginfo3 &"</font>"
end if
%></td>
<td></td>
</tr>
<tr>
<td width="50%">
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?RootDir=<%=RootDir%>">
<img src="icon_home.gif" alt="Root DIR" border=0></a><b>
<%
GetOneFolder (currentfolder)

if ".."&lcase(trim(currentfolder))&"/"= lcase(RootDir) or ".."&lcase(trim(currentfolder))= lcase(RootDir) or lcase(trim(currentfolder)) = lcase(RootDir) then
response.write "根目录 <img src=""icon_upone.gif"" border=0><BR>"
else
response.write replace(currentfolder,"/FileDir","根目录")%>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?nf=<%=UnMappath(strParentFolder)%>&RootDir=<%=RootDir%>"><img src="icon_upone.gif" border=0></a><BR>
<%end if%>
</b>

<select size=22 name=fsel ONDBLCLICK="if((checkSelected(document.mainform.fsel.selectedIndex)&&(checkFolder(document.mainform.fsel[document.mainform.fsel.selectedIndex].value))))
opendir(document.mainform.fsel[document.mainform.fsel.selectedIndex].value);else viewfile(document.mainform.fsel[document.mainform.fsel.selectedIndex].value);">
<%
if str ="" then
response.write "<option value="& currentfolder &">        "
else
response.write str
end if
%>
</select>
</td>
明珠佩佩 2009-01-05
  • 打赏
  • 举报
回复
这里面有你所想要的方法

<%response.buffer= true%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="Const.asp"-->
<!--#include file="../inc/Conn.asp"-->
<%
LoginID=Session("LoginID")
if LoginID="" then response.end

CheckRootDir (RootDir)

dim str,msginfo,strParentFolder
str=""
msginfo1 = "您选择的不是一个合法目录,请重新选择"
msginfo2 = "该目录名已存在或输入错误格式的目录名,请重新输入!"
msginfo3 = "该文件名已存在或输入错误格式的文件名,请重新输入!"

errmsg=trim(request.QueryString("errmsg"))
currentFolder=trim(request.QueryString("nf"))

if currentFolder="" then currentFolder=trim(request.form("nf"))
if currentFolder="" then currentFolder= RootDir

if request.form("faction") = "del" and trim(request("fsel"))<>"" then
DeleteFiles (trim(request("fsel")))
end if

if request.form("faction") = "ren" and trim(request("newname"))<>"" then
RenameFiles trim(request("fsel")), trim(request("newname"))
end if

if request.form("faction") = "cdir" and trim(request("newdir"))<>"" then
CreatDir currentfolder&"/"&trim(request("newdir"))
end if

if request.form("faction") = "makefiles" and trim(request("newfile"))<>"" then
MakeFiles currentfolder&"/"&trim(request("newfile"))
end if

%>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧