3ws.ezer.com 9/7/2010 12:48:03 PM 3ws.ezer.com:ASP:file create:学习 asp sql html code in 简体中文

web tools rank checker

domain .cn
.net .cn .com.cn
你正在阅览 :: 简体中文:: 学习 ASP SQL VB HTML code

学习 .ASP SQL HTML XML CSS JAVA Perl code study
English Chinese_Traditional Chinese_Simplified

你正在阅览 :: 简体中文 Chinese_Simplified

学习.主题:
首页
ASP
. Active-Server-Flash
. Array
. Cache
. Connection
. Count
. Counter
. Distinct
. Email
. File
»Create
»create-and-naming
»delete
»File-obj-Count
»Move
»ReadAll-ReadLine
»Server.MapPath
. Folder
. Function
. GetSQLserver
. Header
. mySQL
. Record
. Recordset
. Request
. Response
. Server
. server-createobject
. ServerVariables
. Session
. Special-Symbols
. String
. Sub
. Time
CSS
Ecommerce
HTML
InternetProtocol
JAVA
Microsoft
php
Robots
SearchEngine
SQL
SQLserver
VBscript
XML

SiteMap

3w....学习.教学 > ASP > file » create

3w learning

file >
create

Title:

FileSystemObject.CreateTextFile(filename[,overwrite[,unicode]]) to create a new file (eg .txt .asp .php .jpg .pl ...any file)


Description:

FileSystemObject.CreateTextFile(filename[,overwrite[,unicode]]) true: allow overwrite false: disallow overwrite


Example Code:

Create a file source code 1: <% ' source code : allow overwrite dim fso,newfile set fso=Server.CreateObject("Scripting.FileSystemObject") set newfile=fso.CreateTextFile(Server.MapPath("newfile1.txt"),true) newfile.WriteLine "text here" newfile.close set newfile=nothing set fso=nothing %> Check a file source code ------------- <% if fso.fileExists ("c:\mypath\newfile1.txt") then end if set fso=nothing %> you may use <% 'Const toAppend = 8 allow to keep old txt and add new txt at the end Set AppendText = "(appent a text line after old file)" Set fso = CreateObject("Scripting.FileSystemObject") filename = server.mappath("c:\mypath\newfile1.txt") Set appendfile = fso.OpenTextFile(filename,8,True) appendfile.writeline(AppendText) appendfile.close Set appendfile = Nothing Set fso = Nothing %>


Example Result:

The '8' in the following line is the mode: Set f=fso.OpenTextFile(Server.MapPath("mynote.txt"),8,true) mode 1 is ForReading mode 2 is ForWriting and mode 8 is ForAppending The 'true' paramater is saying to create the file if it doesn't already exist. Other methods of the textstream object (objFile), depending on the mode are: objFile.Write(string) objFile.Read(length) objFile.ReadAll objFile.ReadLine


fso.CreateTextFile("c:\mypath\newfile1.txt",true) or fso.CreateTextFile(Server.MapPath("newfile1.txt"),true)


..
...
...

[ 9/7/2010 ]

www learning school add more scripts and tips memo
You are at >>3WS.EZER.COM >> 3WS.EZER.COM/ASP/FILE/CREATE.ASP>>ASP
Helpful link:: SEO web tools :: Live PR | SERP checker Google SERP pageranking checker
back to top Ezer code adding :: Questions ;email