954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to use server.mappath

Hi Fiends

I am using file Uploader in my form , & trying to save resumes on my server address, i have a folder (resme) which is on server side & now I want to save resumes on that folder
i am using server.mappath nut it's not working ,it's giving error
that the source not found "c\document and setting\_____"

So please help me to use server.mappath

manoj_582033
Light Poster
39 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

given a file structure as follows...

DirectoryA
  -- SubDirA
  -- SubDirB
DirectoryB
  -- SubDirA
    --  SubDirA1
  -- SubDirB


If your page (lets say "Default.aspx") is in "DirectoryA/SubDirB" like so...

DirectoryA
  -- SubDirA
  -- SubDirB
    -- Default.aspx
DirectoryB
  -- SubDirA
    --  SubDirA1
  -- SubDirB


And you want to map the path to "DirectoryB/SubDirA/SubDirA1" then your code would be written from a relative perspective. E.g.

Server.MapPath("../../DirectoryB/SubDirA/SubDirA1/")


This string "../../DirectoryB/SubDirA/SubDirA1/" is broken down as follows.

"../" - From 'Default.aspx' go up one directory to "DirectoryA"
"../" - From 'DirectoryA' go up one directory to the root
"DirectoryB/" - From the root go into "DirectoryB"
"SubDirA/" - From 'DirectoryB' go into "SubDirA"
"SubDirA1/" - From 'SubDirA' go into 'SubDirA1'

And that pretty much is your server.MapPath explained. It simply requires a path relative to your current executing page. The error your receiving will probably be due to the fact your relative path does not exist.

Fungus1487
Posting Pro in Training
459 posts since Apr 2007
Reputation Points: 66
Solved Threads: 56
 

try this:
Server.MapPath("./Resume");

Aneesh_Argent
Junior Poster
104 posts since Dec 2008
Reputation Points: 16
Solved Threads: 18
 

how to write code for download in asp.net

mithun2010
Newbie Poster
1 post since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

mithun start a new thread...in order to proceed..!

dnanetwork
Practically a Master Poster
Banned
633 posts since May 2008
Reputation Points: 28
Solved Threads: 106
 

hello,

i want know how to upload access db on ftp server and which folder, what is connectionstring, my front-end is asp.net 2008 and back-end access 2003.


pls replay soon......

raj2011
Newbie Poster
1 post since May 2011
Reputation Points: 10
Solved Threads: 0
 

use

server.mappath("path  to server folder") & fileuploadcontrol.filename
' after having attested that the file upload control contains a valid file.
Sarama2030
Junior Poster in Training
74 posts since May 2009
Reputation Points: 10
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You