|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
帮助用户快速实现各种应用服务,ASP商有整合各方面资源的能力,可在短期内为用户提供所需的解决方案。例如,典型的ERP安装,如果要在客户端安装的话需要半年到二年的时间,但是美国的一些ASP商如USI和CORIO能在90—120天内提供ERP应用方案。fso|初学|示例
把上面代码存到一个ASP文件中便可,便利办理服务器上的文件
<title>http://bbs.asp2004.net制造:小灰QQ:103895</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<styletype="text/CSS">
<!--
a:link{
font-size:9pt;
}
a:visited{
font-size:9pt;
}
a:hover{
font-size:9pt;
}
a:active{
font-size:9pt;
}
body{
font-size:9pt;
margin-left:0px;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
line-height:20px;
}
td{
font-size:9pt;
line-height:20px;
}
-->
</style>
<%
action=request.QueryString("action")
temp=split(request.ServerVariables("URL"),"/")
url=temp(ubound(temp))
chklogin()
selectcaseaction
case"logout"
logout()
case"delfile"
delfile()
case"savefile"
savefile()
case"editfile"
fileedit()
case"newfile"
filenew()
case"upload"
upload()
case"saveupload"
saveupload()
case"delfolder"
delfolder()
case"savefolder"
savefolder()
case"editfolder"
editfolder()
case"newfolder"
newfolder()
caseelse
foldername=request.QueryString("foldername")
filename=request.QueryString("filename")
path=foldername
ifpath=""thenpath=server.MapPath("./")
ShowFolderList(path)
endselect
FunctionShowFolderList(folderspec)
temp=request.ServerVariables("HTTP_REFERER")
temp=left(temp,Instrrev(temp,"/"))
temp1=len(folderspec)-len(server.MapPath("./"))-1
iftemp1>0then
temp1=right(folderspec,cint(temp1))
elseiftemp1=-1then
temp1=""
endif
tempurl=temp+replace(temp1,"","/")+"/"
Setfso=CreateObject("Scripting.FileSystemObject")
upfolderspec=fso.GetParentfoldername(folderspec&"")
%>
<ahref="<%=url%>?action=newfolder&foldername=<%=folderspec%>">新建文件夹</a>|<ahref="<%=url%>?action=newfile&filename=<%=folderspec&""%>">新建文件</a>|<ahref="<%=url%>?action=upload">上传文件</a>|<ahref="<%=url%>?foldername=<%=upfolderspec%>">向上</a>|<ahref="file.asp">前往首页</a>|<ahref="<%=url%>?action=logout">加入</a>
<tablewidth="100%"border="0"cellpadding="0"cellspacing="1"bgcolor="#6595D6">
<trbgcolor="#E4E8EF">
<tdwidth="64%"><divalign="center">称号</div></td>
<tdwidth="7%"><divalign="right">巨细</div></td>
<tdwidth="6%"><divalign="center">范例</div></td>
<tdwidth="15%"><divalign="left">修正工夫</div></td>
<tdwidth="8%"><divalign="center">操纵</div></td>
</tr>
<%
列出目次
Setf=fso.GetFolder(folderspec)
Setfc=f.SubFolders
ForEachf1infc
%>
<trbgcolor="#E4E8EF"onMouseOut=this.bgColor=#E4E8EF;onMouseOver=this.bgColor=#FFFFFF;>
<td><ahref="<%=url%>?foldername=<%=folderspec%><%=f1.name%>"><%=f1.name%></a></td>
<td><divalign="right"><%=f1.size%></div></td>
<td><divalign="center">文件夹</div></td>
<td><divalign="left"><%=f1.datelastmodified%></div></td>
<td><ahref="<%=url%>?action=editfolder&foldername=<%=folderspec&""&f1.name%>">修正</a><ahref="<%=url%>?action=delfolder&foldername=<%=folderspec&""&f1.name%>"onclick="{if(confirm(删除文件夹<<%=f1.name%>>么?)){returntrue;}returnfalse;}">删除</a></td>
</tr>
<%
Next
列出文件
Setfc=f.Files
ForEachf1infc
%>
<trbgcolor="#E4E8EF"onMouseOut=this.bgColor=#E4E8EF;onMouseOver=this.bgColor=#FFFFFF;>
<td><ahref="<%=tempurl+f1.name%>"target="_blank"><%=f1.name%></a></td>
<td><divalign="right"><%=f1.size%></div></td>
<td><divalign="left"></div></td>
<td><divalign="left"><%=f1.datelastmodified%></div></td>
<td><ahref="<%=url%>?action=editfile&filename=<%=folderspec&""&f1.name%>">修正</a><ahref="<%=url%>?action=delfile&filename=<%=folderspec&""&f1.name%>"onclick="{if(confirm(删除文件<<%=f1.name%>>么?)){returntrue;}returnfalse;}">删除</a></td>
</tr>
<%
Next
setfso=nothing
%>
</table>
<%
EndFunction
文件操纵
functiondelfile()
filename=request.QueryString("filename")
setfso=server.CreateObject("scripting.filesystemobject")
fso.deletefile(filename)
tempurl=url&"?foldername="&fso.GetParentfoldername(filename)
setfso=nothing
response.Redirect(tempurl)
endfunction
functionsavefile()
filename=request.Form("filename")
content=request.Form("content")
filename1=request.Form("filename1")
ifrequest.ServerVariables("PATH_TRANSLATED")filenamethen
setfso=server.CreateObject("scripting.filesystemobject")
setf1=fso.opentextfile(filename,2,true)
f1.write(content)
f1.close
iffilename1""andfilename1filenamethenfso.deletefile(filename1)
tempurl=url&"?foldername="&fso.GetParentfoldername(filename)
setfso=nothing
endif
response.Redirect(tempurl)
endfunction
functionfilenew()
filename=request.QueryString("filename")
content=""
fileformfilename,content,filename1
endfunction
functionfileedit()
filename=request.QueryString("filename")
filename1=request.QueryString("filename")
setfso=server.CreateObject("scripting.filesystemobject")
setf1=fso.opentextfile(filename,1,true)
content=server.HTMLEncode(f1.readall)
f1.close
setfso=nothing
fileformfilename,content,filename1
endfunction
functionfileform(filename,content,filename1)
%>
<tablewidth="100%"border="0"align="center"cellpadding="0"cellspacing="0">
<formname="form1"method="post"action="<%=url%>?action=savefile">
<tr>
<td><inputname="filename1"type="hidden"value="<%=filename1%>"><inputname="filename"type="text"value="<%=filename%>"style="width:100%"></td>
</tr>
<tr>
<td><textareaname="content"wrap="VIRTUAL"style="width:100%;height:100%;font:Arial,Helvetica,sans-serif;"onKeyUp="style.height=this.scrollHeight;"><%=content%></textarea></td>
</tr>
<tr>
<td><center><inputtype="submit"name="Submit"value="保留"style="width:200"><inputtype="reset"name="Submit2"value="重置"style="width:200"></center></td>
</tr>
</form>
</table>
<%
endfunction
文件夹操纵函数
functiondelfolder()
foldername=request.QueryString("foldername")
setfso=server.CreateObject("scripting.filesystemobject")
tempurl=url&"?foldername="&fso.GetParentfoldername(foldername)
fso.deletefolder(foldername)
setfso=nothing
response.Redirect(tempurl)
endfunction
functionsavefolder()
foldername=request.Form("foldername")
foldername1=request.Form("foldername1")
setfso=server.CreateObject("scripting.filesystemobject")
iffoldername1=""then
setf=fso.createfolder(foldername)
else
fso.MoveFolderfoldername1,foldername
endif
tempurl=url&"?foldername="&f
setfso=nothing
response.Redirect(tempurl)
endfunction
functionnewfolder()
foldername=request.QueryString("foldername")&""
formfolderfoldername,foldername1
endfunction
functioneditfolder()
foldername=request.QueryString("foldername")
foldername1=request.QueryString("foldername")
formfolderfoldername,foldername1
endfunction
functionformfolder(foldername,foldername1)
%>
<tablewidth="100%"border="0"align="center"cellpadding="0"cellspacing="0">
<formname="form1"method="post"action="<%=url%>?action=savefolder">
<tr><td><inputname="foldername1"type="hidden"value="<%=foldername1%>"><inputname="foldername"type="text"value="<%=foldername%>"style="width:100%"></td></tr>
<tr><td><center><inputtype="submit"name="Submit"value="保留"style="width:200"><inputtype="reset"name="Submit2"value="重置"style="width:200"></center></td></tr>
</form>
</table>
<%
endfunction
functionupload()
%>
<formaction="file.asp?action=saveupload"method="post"enctype="multipart/form-data"name="form2">
<divalign="center">有待完成
<inputtype="file"name="file"style="width:80%">
<inputtype="submit"name="Submit"value="提交">
</div>
</form>
<%
endfunction
functionsaveupload()
有待完成
endfunction
上岸
functionchklogin()
password=request.Form("password")
ifpassword="ok"thensession("login")="login"
ifsession("login")"login"thenlogin
endfunction
functionlogin()
%>
<formname="form1"method="post"action="<%=url%>?action=chklogin">
<center>请输出暗码:<inputname="password"type="password"><inputtype="submit"name="Submit"value="上岸"></center>
</form>
<%
response.End()
endfunction
functionlogout()
session.Abandon()
response.Redirect(url)
endfunction
%>
问题是他们究竟是喜欢他们是使用软件时,速度快还是速度慢好.(当然在3秒以内).无论是他们输入资料时,查找资料时,分析资料时. |
|