p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Folder access

Message #1 by giswim1@a... on Tue, 10 Jul 2001 16:46:11
Thanks for the response, Robert, but I actually found an even neater way 
to do it.  All you have to do is :

fileLoc = Server.MapPath(".")

This will give you the path of whatever directory the current page is 
located in.  You can also do:

fileLoc = Server.MapPath("\")
fileLoc = Server.MapPath("..")

These will give you the parent directory.

If you need to set a path, then, you just concatenate "\whatever 
directory" to fileLoc.  Pretty cool :)

> well, server.mappath() does return tghe complete path, icnluding the 
> driectory, so you just need to do some fancy string manipulation..
> for example:
> fileName = "somefile.asp"
> fileLoc = server.mappath(fileName)
> filePath = replace(fileLoc, fileName,"")
> At 04:46 PM 7/10/2001 +0000, you wrote:
> >I have an asp page that allows file uploads to the server.  Right now, 
> >directory is hard-coded into the page.  However, in order to make the 
> >more easily moved from one server to another, I would like to make the
> >folder name dynamic.  I know you can use Server.MapPath(file) to get the
> >whole path of the file.  This is what I would like to do for the
> >directory.  Is there any way to do this?
> >
> >Thank you!
> >
> Robert Chartier
> Author, AspFree.com
>  xxx-xxx-xxxx
> rob@a...
> http://www.aspfree.com/devlinks
> http://www.aspfree.com/authors/robert
> http://www.aspalliance.com/nothingmn

  Return to Index