《拓文asp.net网站内容管理系统》官方演示站。
 设为首页  
 收藏本站
 作者:黄振安
 QQ:53854651
首 页 开源拓文.NET编程网站编程网页设计图形图像数据库软件工程留言本
    站内搜索:  
您现在的位置: 拓文网络 → 网站编程 → ASP → asp 中常用的文件处理函数[正文]

热 门 文 章

相 关 文 章
  • ASP.NET性能优化
  • ASP脚本循环语句
  • 在.NET框架应用程序中发送电子邮件
  • .net打包自动安装数据库
  • asp.net开发wap必备:更好的匹配手机设备
  • 用ashx动态生成文件
  • windows 2003下asp.Net站点无法使用用户名+密码的方
  • ASP.NET中17种正则表达式
  • 提高ASP.Net应用程序性能的十大方法
  • 一个通过web.Mail发送邮件的类
  • asp 中常用的文件处理函数
     
    [作者:不详    转贴自:不详    点击数:    更新时间:2006-3-13 8:53:12]

    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
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function SaveRandFileName(byval szFilename) ''根据原文件名生成新的随机文件名
     randomize
     ''ranNum=int(90000*rnd)+10000
     ''if month(now)<10 then c_month="0" & month(now) else c_month=month(now)
     ''if day(now)<10 then c_day="0" & day(now) else c_day=day(now) 
     ''if hour(now)<10 then c_hour="0" & hour(now) else c_hour=hour(now)
     ''if minute(now)<10 then c_minute="0" & minute(now) else c_minute=minute(now)
     ''if second(now)<10 then c_second="0" & second(now) else c_second=minute(now)
     fileExt_a=split(szFilename,".")
     fileExt=lcase(fileExt_a(ubound(fileExt_a)))
     
     SaveRandFileName=replace(replace(replace(now,":",""),"-","")," ","")&int(10*rnd)&"."&fileExt
     ''GenerateRandomFileName = year(now)&c_month&c_day&c_hour&c_minute&c_second&"_"&ranNum&"."&fileExt
    end function
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function jaron_replacer(strContent,start_string,end_string,replace_string)
    ''CMS替换函数:源字符串,前部分,后部分,替换成的字符
    ''返回被替换后的字符串
     jaron_replacer = replace(strCont


    首页 | 1 | 尾页  共 1 页
     
    hch004 打印本页 关闭窗口

         文 章 评 论
    评论人 查看该文章的评论 发表时间
       笔 名* : 0 50分 60分 70分 80分 90分 100分
    评论内容 *: (最多1000字。当前字数:0)


    没有相关评论,欢迎您参与!

    - 关于本站 - 网站帮助 - 下载声明 - 友情连接 - 网站地图 -
    Copyright © 2005-2006 myTopWin.Com. All Rights Reserved . [桂ICP备06004496号]