Solved

PATH for CreateTextFile

Posted on 2004-10-18
5
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

728 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