[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] OT [RaQ4]: FileSystemObject file corruption
- Subject: [cobalt-users] OT [RaQ4]: FileSystemObject file corruption
- From: "Richard Abrams" <richard@xxxxxxxxxxxxxx>
- Date: Thu Aug 16 18:24:02 2001
- Organization: Artejano Design and Marketing
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Hi folks, sorry for the slightly OT message!
Has anyone experienced problems using the ASP FileSystemObject to write text
to a file?? I'm having problems with the text file corrupting and can't seem
to find any clues.
The brief was to create an updatable web page without use of a database. I
figured that I could use FileSystemObject to push text into a file, and then
use SSI to pull the information into a web page containing formatting and
layout.
I've created an empty file with a .txt extension in a
/home/sites/sitex/web/includes/ folder and used CHMOD 666 for permissions.
Everything starts fine, and the file is overwritten with new text, but after
about 4 updates I find bits of the previous submission being left in the
file. Help? :-)
Here's the code!
<%
' Check if page called by form submission
if (Request.Form("Article1") <> "") then
articleText = Request.Form("Article1")
fileName = Server.Mappath("includes/article1.txt")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
' 2 opens file for write, True allows overwrite of existing file
Set outputFile = fso.OpenTextFile(FileName, 2, True)
outputFile.writeline(articleText)
' Clean up
outputFile.Close
set outputFile = nothing
set fs = nothing
end if
%>
Thanks in advance!
--
> Richard Abrams
(Lead Web Developer)
> Artejano Design and Marketing
The Old Bakehouse, 21 The Street,
Lydiard Millicent, Swindon,
Wiltshire. SN5 3LU
> ICQ: 105995147
> Tel: +44 (0)1793 772243
> Fax: +44 (0)1793 772207
> Web: www.artejano.com