Current location: Hot Scripts Forums » Programming Languages » ASP » Problem Write text into text file


Problem Write text into text file

Reply
  #1 (permalink)  
Old 09-09-04, 10:49 PM
superman2004 superman2004 is offline
Newbie Coder
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Problem Write text into text file

Code:
DIM Stuff, myFSO, WriteStuff, source, number, description
  Stuff = "hello"
  SET myFSO = CreateObject("Scripting.FileSystemObject") 
  SET WriteStuff = myFSO.OpenTextFile("C:/Inetpub/wwwroot/Test_1/testing.txt", 8, True) 
  WriteStuff.WriteLine(Stuff) 
  WriteStuff.Close 
  response.write "<H2>Error Found, please contact Technical Support</H2>"
  SET WriteStuff = NOTHING 
  SET myFSO = NOTHING
This is the error message :
Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
Reply With Quote
  #2 (permalink)  
Old 09-10-04, 12:26 AM
PromptLogic PromptLogic is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Try using the server map path when opening.

Try this:

PHP Code:

SET WriteStuff myFSO.OpenTextFile(Server.MapPath("testing.txt"), 8True
Let me know if that helps.
Reply With Quote
  #3 (permalink)  
Old 09-12-04, 11:00 PM
superman2004 superman2004 is offline
Newbie Coder
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sorry, still cannot.

Pls help
Reply With Quote
  #4 (permalink)  
Old 09-18-04, 12:13 AM
rpsajwan rpsajwan is offline
Newbie Coder
 
Join Date: Aug 2004
Location: India
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Cool Write in text file

use following code

<%
dim fs,f,ts
set fs=Server.CreateObject("Scripting.FileSystemObject ")
Set f=fs.GetFile(Server.Mappath("test.txt"))

Set ts=f.OpenAsTextStream(2,-2)
ts.Write("Hello World Test File!")
ts.Close

Set ts=f.OpenAsTextStream(1)
Response.Write(ts.ReadAll)
ts.Close
set ts=nothing
set f=nothing
set fs=nothing
%>



hope it will help u
__________________
ravi
Reply With Quote
  #5 (permalink)  
Old 09-18-04, 12:48 AM
traceMe traceMe is offline
Newbie Coder
 
Join Date: Oct 2003
Location: india(mumbai)
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
you need to give permision

boy your wwwroot folder give all the permission to it read,write, delete this error will go away and still if you have prob send me the code at raj_silverprod@gmail.com i'll help in this matter as i had done the same mistake of not giving the folder permission and while setting the permission see to it that its sub folder inherit the parent properties...i hope you get what iam saying...
Reply With Quote
  #6 (permalink)  
Old 09-21-04, 02:13 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
Basiclly what traceMe is trying to say is you need to set Read/Write permissions to the directory that the file is in.
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP write to text file veeco Script Requests 2 02-10-10 02:48 PM
MySQL Query problem Wraith PHP 5 03-06-04 05:16 PM
How to write a php script to load a text file into a table automatically? xmxpcom PHP 2 02-12-04 08:37 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 04:28 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 03:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.