469,898 Members | 1,815 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Best approach - writing text file

Hi all,

Ok - minor fly in my ointment...

I have an application which was successfully writing data from submitted
forms to a text file in a directory - in this case:

/data/findata.txt

This was fine because the forms lived at the root level with this directory.

Since then I have added enabled the forms to be used on subdirectories :

/subdirectory/myform.asp

I've used the same code for server.mapparth("data") etc - but instead of
locating the directory at the root of the server called "data" it looks to
the current directory- doesn't find it and creates another! eek!

What I need is a way to say "right, it doesnt matter what level you are at
at the moment, always look at the root level /data directory"...

This has to be fairly dynamic - on the development server here its got a
different file structure than on the live server (ie, it lives another level
down again on the physical drive)...

Anyone got a good idea on how to look back up?

I do have one way to test which level they are at - but I feel that its a
bit 'weak' - I have an ID that tells me if they are working on the upper or
lower levels (ie, anything other than 1 is a lower level) - whilst I realise
I could use this in the test I'm not sure if its going to be 100% fool proof
to base this criteria on this ID.

Therefore I was hoping for a better way using the server.mappath etc...

Thanks in advance for any help.

Regards

Rob
Jul 19 '05 #1
4 1934


Rob Meade wrote:
Hi all,

Ok - minor fly in my ointment...

I have an application which was successfully writing data from submitted
forms to a text file in a directory - in this case:

/data/findata.txt

This was fine because the forms lived at the root level with this directory.

Since then I have added enabled the forms to be used on subdirectories :

/subdirectory/myform.asp

I've used the same code for server.mapparth("data") etc - but instead of
locating the directory at the root of the server called "data" it looks to
the current directory- doesn't find it and creates another! eek!

What I need is a way to say "right, it doesnt matter what level you are at
at the moment, always look at the root level /data directory"...


So you want
Server.MapPath("/data")
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #2
"Martin Honnen" wrote ...
So you want
Server.MapPath("/data")


Hi Martin,

Thanks for your reply - the / looks 'anywhere' then does it?

Incidently - if I had more than one data directory - how would it know which
to return as correct? Or would it just return the last one it finds?

Cheers

Rob
Jul 19 '05 #3


Rob Meade wrote:
"Martin Honnen" wrote ...

So you want
Server.MapPath("/data")

Hi Martin,

Thanks for your reply - the / looks 'anywhere' then does it?

Incidently - if I had more than one data directory - how would it know which
to return as correct? Or would it just return the last one it finds?


No, / is the root of the virtual server directory structure and
Server.MapPath("/data")
looks for a data directly under the root.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #4
"Martin Honnen" wrote ...
No, / is the root of the virtual server directory structure and
Server.MapPath("/data")
looks for a data directly under the root.


Hi Martin,

Many thanks for your reply - I will give that a go...

Thanks again,

Rob
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

136 posts views Thread by Matt Kruse | last post: by
4 posts views Thread by Greg Linwood | last post: by
1 post views Thread by Shawn Ferguson | last post: by
12 posts views Thread by Jeff | last post: by
10 posts views Thread by Brendan Miller | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.