Click here to Skip to main content
13,097,012 members (73,687 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to get local path of file using file uploader in, like i browse file D:\\wildlife.flv

I want to get this path using file uploader i tried many thing but it giving me path like D:\\ video application\\wildlife but i want the path like: D:\\ wildlife with out my application folder name.
actually i want to pass path to this command:
_mhandler.CustomCommand = "-i D:\\WildLife.wmv -vf fade=in:1:400 C:\\ConvertedV.wmv";

thanks and regards.

Posted 28-Mar-13 20:47pm
Updated 28-Mar-13 23:01pm
Hariharan Arunachalam 29-Mar-13 4:59am
Do you mean to get the client side file path on the server end? I don't think that its possible. You have to save a copy on the server and do the work as necessary.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I think This Solution Will Help overcome from your problem...

Server.MapPath("~/Files") returns an absolute path based on a folder relative to your application. The leading ~/ tells ASP.Net to look at the root of your application.

To use a folder outside of the application:

 //check to make sure a file is selected
if (FileUpload1.HasFile)
    //create the path to save the file to
    string fileName = Path.Combine(@"E:\Project\Folders", FileUpload1.FileName);
    //save the file to our local path

Of course, you wouldn't hardcode the path in a production application but this should save the file using the absolute path you described.

With regards to locating the file once you have saved it (per comments):

if (FileUpload1.HasFile)
    string fileName = Path.Combine(@"E:\Project\Folders", FileUpload1.FileName);
    FileInfo fileToDownload = new FileInfo( filename ); 
    if (fileToDownload.Exists){ 
    else { 
        MessageBox("File Not Saved!"); 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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