Click here to Skip to main content
14,325,048 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi
how to get full path of input type file (image upload)..

because when i upload image , and check in .cs code , i get only name of image and not full path


pls advice

regards
maulik shah
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

Use Server.MapPath to fetch the full path.

Refer below to know different ways of using it.

http://www.aspnetcodes.com/2013/06/servermappath-in-c.html[^]
   
v2
Comments
maulikshah1990 22-Jan-14 6:49am
   
can u give example code for the same using below

<input type="file" name="getypepath" id="idpath" />
Rate this:
Please Sign up or sign in to vote.

Solution 2

As far as I know, you can not get the full path of a file on client side. You can get full path of a file which was on server but not like that "DriveName:\FolderName\FileName". Path of a file on server is like "www.domain_name.com/folder_name/file_name".
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

You cannot get the full path from the server side. When you think about it, this makes perfect sense as it would represent a major security vulnerability if the upload functionality were to reveal details about what the client side folder structures are. If you want to achieve this type of effect, then you need to write your own control that runs on the client side - if your app is running on Windows only, you could launch this as a ClickOnce app for instance. It's a very rare situation, however, where you need access to this level of detail,
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100