asp创建文件有两种方法,可以用fso,也可以用stream,这里给你一个stream的例子
=====代码=======
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
'使用stream对象输出内容至文件
Function SaveTOFile(ByVal FileName,ByRef Content,ByVal Chrset)
On Error Resume Next
dim stm:set stm=Server.CreateObject("ADODB.Stream")
stm.Type=2
stm.Mode=3
stm.CharSet=Chrset
stm.Open
stm.WriteText content
stm.SaveToFile Server.MapPath(FileName),2
stm.Flush
stm.Close
Set stm=Nothing
If Err Then
WriteTOFile = False
Else
WriteTOFile = True
End If
End Function
If Request.Form<>"" Then
SaveTOFile "123.txt",Request.Form("text"),"gb2312"
Response.Write("文件保存成功!")
End If
%>
<form method="post">
文件内容:
<textarea name="text">
</textarea>
<br />
<input type="submit" value="提交" />
</form>
</body>
</html>