Solved

PATH for CreateTextFile

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Classic ASP + JS 4 83
Highlight a word from some text 16 50
How to hide jquery hemiintro in returning user? 1 68
ASP SQL Syntax Duplicate Key 7 93
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

19 Experts available now in Live!

Get 1:1 Help Now