Solved

PATH for CreateTextFile

Posted on 2004-10-18
5
220 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ODBC connection string for ODBC 6.01 24 65
two-way Authentication ASP 3 70
C# page opens in new window 3 45
JSON error 4 38
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now