您所在的位置: 首页 > 开发 > .Net > ASP.NET >

ASP中常用的文件处理函数

http://developer.51cto.com  2005-09-15 09:35  Andy.m  PConline  我要评论(0)
  • 摘要:本文介绍了ASP 中处理文件上传以及删除时常用的自定义函数
  • 标签:ASP
ASP 中处理文件上传以及删除时常用的自定义函数:
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'所有自定义的VBS函数
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function DeleteFile(Filename) '删除文件
if Filename<>"" then
Set fso = server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(Filename) then
fso.DeleteFile Filename
end if
set fso = nothing
end if
end function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function CreateDIR(byval LocalPath) '建立目录的程序,如果有多级目录,则一级一级的创建
on error resume next
LocalPath = replace(LocalPath,"\","/")
set FileObject = server.createobject("Scripting.FileSystemObject")
patharr = split(LocalPath,"/")
path_level = ubound(patharr)
for i = 0 to path_level
if i=0 then pathtmp=patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/"
cpath = left(pathtmp,len(pathtmp)-1)
if not FileObject.FolderExists(cpath) then FileObject.CreateFolder cpath
next
set FileObject = nothing
if err.number<>0 then
CreateDIR = false
err.Clear
else
CreateDIR = true
end if
end function
专题:ASP.NET 2.0基础开发指南
微软的Ajax:Atlas(ASP.net AJAX)
ASP.NET开发教程
ASP实用开发教程
JSP开发基础教程
 
 验证码: (点击刷新验证码)   匿名发表
  • .NET程序员面试指南

  • 作者:朱毅
  • 本书着重针对.NET技术职位的应聘者,在.NET框架各个技术类别中,选取最常出现在.NET面试中的问题,进行分析和解答,同时解释和..
Copyright©2005-2008 51CTO.COM 版权所有