静态页面生成文件夹问题

ytbtagmy 2009-03-15 10:03:54
改了一个生成静态页面的代码,可是出现一个问题,如果没有新的文件夹时,可以建立一个新的文件夹,并在文件夹下生成shtml的页面,可是当已经有了一个文件夹后再添加内容时提示文件夹已经存在,做了判断可是还是会提示文件夹已经存在,那位高手帮忙看看。
<!-- #include file="inc/CheckUser.asp"-->
<!-- #include file="inc/Conn.asp"-->
<!--#include file="inc/lib.asp" -->
<!-- #include file="inc/Global.asp"-->

<%
function getFormItem(m_StrFmNm)
getFormItem=FilterStr(trim(request.form(m_StrFmNm)))
end function
CatalogID=getFormItem("Catalog") '类编号=CatalogID
M_ID=getFormItem("class") '类编号=M_ID
TitleName=getFormItem("TitleName") '信息标题=TitleName
ArticleSource=getFormItem("ArticleSource") '信息来源
For i = 1 To Request.form("Content").Count '信息内容=Content
Content = Content & Request.form("Content")(i)
Next
Summary=getFormItem("Summary") '信息摘要=Summary
DefaultPicUrl=getFormItem("DefaultPicUrl") '缩略图片=DefaultPicUrl
UploadFiles=getFormItem("UploadFiles") '图片列表
Uploads=getFormItem("Uploads") '文件列表(所有上传的文件)
ImgNews=getFormItem("ImgNews") '图片新闻=ImgNews
fname = makefilename(now()) 'makefilename为自定义函数
folder = "../html/"&date()&"/"
filepath = folder&fname

set rs=Gf_GetRs("select * from Article where A_ID=-1")
rs.addnew
if CatalogID<>"" then rs("WM_ID") = CatalogID '栏目ID
if TitleName<>"" then rs("A_TITLE") = TitleName '信息标题
if ArticleSource<>"" then rs("A_SOURCE") = ArticleSource '信息来源
if Content<>"" then rs("A_CONTENT") = Content '信息内容
if Summary<>"" then rs("A_SIMPLE_CONTENT") = Summary '信息摘要
if DefaultPicUrl<>"" then rs("A_IMAGE") = DefaultPicUrl '缩略图片
if UploadFiles<>"" then rs("A_IMAGELIST") = UploadFiles '图片列表
if Uploads<>"" then rs("A_UPLOADLIST") = Uploads '文件列表
if filepath<>"" then rs("A_FILEPATH") = filepath '静态地址
if ImgNews=true then rs("A_IMG_NEWS") = true else rs("A_IMG_NEWS") = false '图片新闻
rs("A_HITS") = 0
rs("A_CHECKED") = true
rs.update
rs.close
set rs=nothing

set rs1=Gf_GetRs("select m_id,m_html from A_moban where m_id=" & M_ID)
mb_code=rs1("m_html")
rs1.close
set rs1=nothing
Func_Conn.close
set Func_Conn=nothing
TitleName=htmlencode(TitleName)
ArticleSource=htmlencode(ArticleSource)
Content=htmlencode(Content)
mb_code=replace(mb_code,"$cntop{LogContent}",now())
mb_code=replace(mb_code,"$cnlaiyuan{LogContent}",ArticleSource)
mb_code=replace(mb_code,"$cnleft{LogContent}",TitleName)
mb_code=replace(mb_code,"$cnright{LogContent}",Content)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(filepath) then '文件存在
else
fso.CreateFolder(Server.MapPath(folder))
end if
Set fout = fso.CreateTextFile(Server.MapPath(filepath))

fout.WriteLine mb_code
fout.close
%>

<script>
var a=confirm('信息添加成功!继续添加吗?')
if (a)
document.location="ArticleAdd.asp?cid=<%=catalogid%>"
else
document.location="ArticleList.asp?catalog=<%=catalogid%>"
</script>
...全文
62 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

28,390

社区成员

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

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