asp的FSO之opentextfile打开文件
|
admin
2011年12月24日 18:18
本文热度 6861
|
确定文件路径是否正确,然后执行下边的程序
set fso=server.CreateObject("scripting.filesystemobject")
set txtfile=fso.opentextfile(server.MapPath("\")&"\file2.txt",2,true,-2)
str=txtfile.ReadAll()
txtfile.Close()
Set fso=Nothing
Set txtfile=Nothing
Response.write(str)
该文章在 2011/12/24 18:18:43 编辑过
| |
全部评论2 |
|
admin
2011年12月24日 18:23
读取指定的行数:
set fso=server.createobject(scripting.filesystemobject)
set emlfile=fso.opentextfile(文件在硬盘上的位置,1,false,-2)
if not emlfile.atendofstream then
look_i=0 '指定读取前5行
While not emlfile.AtEndOfStream and look_i
该评论在 2011/12/24 18:23:25 编辑过
|
|
admin
2011年12月24日 18:32
<%
'Jmail收取附件函数
'Function getAttachments(id)
Set Attachments = msg.Attachments
separator = ,
'创建文件夹,文件夹的名字为时间如2004-12-15152021
gg=now()
gg1=replace(gg, , )
gg1=replace(gg1, : , )
gg1= c:\temp\ &gg1
Dim fso, f
Set fso = CreateObject( Scripting.FileSystemObject )
'判断c:是否以存在temp文件夹,如果不存在则需要建立该文件夹
if not fso.FolderExists( c:\temp ) then
fso.CreateFolder c:\temp
end if
Set f = fso.CreateFolder(gg1)
'创建文件夹完毕
For i = 0 To Attachments.Count - 1
If i = Attachments.Count - 1 Then
separator =
End If
Set at = Attachments(i)
at.SaveToFile( gg1& \ & at.Name )
tt=gg1& \ & at.Name
'response.Write tt11= &tt
%>
<tr>
<td> 附 件: </td>
<td> <a href= <%=tt%> > <%=at.name%> </a> </td>
</tr>
<%
Next
%>
该评论在 2011/12/24 18:33:27 编辑过
|