www.gusucode.com > WapEditFile手机WAP文件管理器源码 > wap_newfilepost.asp
<!--#include file="wap_common.asp"--> <!--#include file="wap_check.asp"--> <!--#include file="wap_verify.asp"--> <%Response.ContentType="text/vnd.wap.wml; charset=utf-8"%> <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head><meta http-equiv='Cache-Control' content='no-cache'/> </head> <card id='wuyumin' title='新建文件结果'> <p> <!--#include file="wap_top.asp"--> <!--#include file="wap_top_end.asp"--> </p> <p> <% '-------------------------------------------------- '函数名称:WriteToTextFile '作用:利用AdoDb.Stream对象来写入文本文件 '-------------------------------------------------- Function WriteToTextFile(FileUrl,byval Str,CharSet) If FileUrl="" OR IsNull(FileUrl) Then WriteToTextFile="" Exit Function End If FileUrl=Server.MapPath(FileUrl) Dim stm set stm=server.CreateObject("adodb.stream") stm.Type=2 '以文本模式读取 stm.mode=3 stm.charset=CharSet stm.open stm.WriteText str stm.SaveToFile FileUrl,2 stm.flush stm.Close set stm=nothing End Function on error resume next dim NewFile,CodeFile NewFile=trim(request("NewFile")) CodeFile=trim(request("CodeFile")) set fso=Server.CreateObject("Scripting.FileSystemObject") if fso.FileExists(Server.MapPath(NewFile))=true then response.Write "操作过程中发生错误。可能同名同类型文件已经存在或相对路径不存在,请仔细核对一下,再重新操作!"&chr(13) else call WriteToTextFile (NewFile,"暂无内容,请编辑。。。",CodeFile) if err.number<>0 then response.Write "操作过程中发生错误。可能同名同类型文件已经存在或相对路径不存在,请仔细核对一下,再重新操作!"&chr(13) else response.Write "恭喜您!您已经成功操作!"&chr(13) end if end if %> </p> <p> <!--#include file="wap_footer_head.asp"--> <!--#include file="wap_footer.asp"--> </p> </card> </wml>