Hello,
How to get the full path from fileupload control browsing the path to it?
I want to get as this.
c:\Images\mine.jpg

Hello,
The code which you given is only working in Internet Explorer and not working in other browsers such as firefox, opera, chrome....

Member Avatar for siju kuriakose

try some thing like this as per your purpose...
System.Drawing.Image Img = default(System.Drawing.Image);
Img = System.Drawing.Image.FromStream(fupho.PostedFile.InputStream, false);

Member Avatar for siju kuriakose

Hi,

I used the above code to handle images uploaded by Fileupload control.

But geting full path from Fileupload control is depend on the browser which you use.
It is a matter of security level and you will not get full path from all browsers.
Hope this help you.

For getting the full path of the file.
check the following code

FileUpload1.PostedFile.FileName

Dim fileName As String = "myfile"
Dim pathname As String = "\mydir\"
Dim fullPath As String

fullPath = Path.GetFullPath(pathname)
Console.WriteLine("GetFullPath('{0}') returns '{1}'", pathname, fullPath)

fullPath = Path.GetFullPath(fileName)
Console.WriteLine("GetFullPath('{0}') returns '{1}'", fileName, fullPath)

fileUpload1.SaveAs(Server.MapPath(“~/uploads/”) + System.IO.Path.GetFilename(fileUpload1.FileName));

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.