Click here to Skip to main content
Rate this: bad
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 at 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 Mika Wendelius 236
1 Abhinav S 155
2 Peter Leow 140
3 Kornfeld Eliyahu Peter 115
4 Sergey Alexandrovich Kryukov 115
0 Sergey Alexandrovich Kryukov 8,593
1 OriginalGriff 6,536
2 Peter Leow 3,727
3 Zoltán Zörgő 3,456
4 Richard MacCutchan 2,417

Advertise | Privacy | Mobile
Web04 | 2.8.150123.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