Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2003, 01:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generated file not in directory ... :(

Hi All, I have the following code to generate a text file from Client side application. I changed my IE security to low ... so I won't get Error:"Automation server can't create object" ... however, I can't seem to find the file I created. I don't know what's wrong even though I tried to change the directory path to "http:\localhost\..." and it still doesn't work. Please help.

===============================

.....

<input id="btnUpdate" type="button" value="Update book info" onclick="updateBookInfo()"></input>

.....

function updateBookInfo()
    {
         createOrReplaceElement("Title", txtTitle.value, docBook.documentElement);
         createOrReplaceElement("Publisher", txtPublisher.value, docBook.documentElement);
         createOrReplaceElement("PubDate", txtPubDate.value, docBook.documentElement);
         createOrReplaceElement("Abstract", txtAbstract.value, docBook.documentElement);
         createOrReplaceElement("Pages", txtPages.value, docBook.documentElement);
         createOrReplaceElement("ISBN", txtISBN.value, docBook.documentElement);
         createOrReplaceElement("Price", txtPrice.value, docBook.documentElement);

         renderElements();
         addToFile();
    }

.....

function addToFile()
   {
           var fso;
           var tf;
           var fi;

       fso = new ActiveXObject("Scripting.FileSystemObject");
       tf = fso.CreateTextFile("C:\Inetpub\wwwroot\XML\Book\Ch apter5_ClientSide\book.txt", true);
       // Write a line with a newline character.
       tf.WriteLine("Testing 1, 2, 3.") ;
       // Write three newline characters to the file.
       tf.WriteBlankLines(3) ;
       // Write a line.
       tf.Write ("This is a test.");
       tf.Close();
   }

....


 
Old August 11th, 2005, 12:21 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

 I am getting same error as you. I installed windows Script 5.6 for 2003 server. then also i am getting error. why? any idea?

Regards,
Jagdish
([email protected])

 
Old August 11th, 2005, 08:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Escape the backslashes:
Code:
tf = fso.CreateTextFile("C:\\Inetpub\\wwwroot\\XML\\Book\\Chapter5_ClientSide\\book.txt", true);
If you're going to save an XML file then you can use the save method, it needs the same level of secrity as the FileSystemObject.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
File Directory Access ra7207 VB.NET 1 June 20th, 2006 01:45 PM
txt file generated from SQl BCP nidhigarg9 SQL Server 2000 1 June 16th, 2006 02:16 PM
Q. How do I upload a file to a directory? richard.york PHP FAQs 0 April 8th, 2004 05:47 AM
file/directory iteration nbryson C# 5 August 1st, 2003 05:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.