Solved

PATH for CreateTextFile

Posted on 2004-10-18
5
230 Views
Last Modified: 2008-07-03
Hello Experts!


I am creating a .txt file in ASP using this;

CreateObject("Scripting.FileSystemObject")
CreateTextFile("c:\somefile.txt")

...I am on a webhotel though and need to make the path like if so;

"/texts/group1/text1.txt"

What then would be like; "www.mysite.com/texts/group1/text1.txt"

How do I do that??

Thank you!

/Jens
0
Comment
Question by:Jens979
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:nurbek
ID: 12337630
Use Server.MapPath() method

like

Server.MapPath("texts/group1/text1.txt")
0
 

Author Comment

by:Jens979
ID: 12337672
Thank you!
I still have a small problem.

how do I write the entire line?

Set tfile=fs.CreateTextFile Server.MapPath("texts/group1/text1.txt")

Gives me an error.

How is the right way??

/Jens
0
 
LVL 6

Expert Comment

by:masirof
ID: 12337710
Where is your file which should create file?
/texts/  ?? or some other directory..

for example if you are here

root/
        file.asp
and text file should be created here
root/texts/group1/text1.txt

Set tfile=fs.CreateTextFile Server.MapPath("texts/group1/text1.txt") this should work..

if other you can use ../ etc to point to right place,

and anyway, which error it does give? path not found?
0
 
LVL 13

Accepted Solution

by:
nurbek earned 125 total points
ID: 12337721
Use paranthesis

Set tfile=fs.CreateTextFile(Server.MapPath("texts/group1/text1.txt"))

also give the write permission to group1 folder

0
 
LVL 6

Expert Comment

by:masirof
ID: 12337734
zigeyin dese :))
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question