Click here to Skip to main content
11,922,416 members (31,550 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 21:47pm
Edited 29-Mar-13 0:01am
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
0 OriginalGriff 453
1 Dave Kreskowiak 335
2 Sergey Alexandrovich Kryukov 263
3 Richard MacCutchan 225
4 ppolymorphe 175
0 OriginalGriff 7,231
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,356
3 George Jonsson 2,865
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2015
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