Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:31:49+00:00 2026-06-03T17:31:49+00:00

I want to upload a file in a physical path such as E:\Project\Folders .

  • 0

I want to upload a file in a physical path such as E:\Project\Folders.

I got the below code by searching in the net.

//check to make sure a file is selected
if (FileUpload1.HasFile)
{
    //create the path to save the file to
    string fileName = Path.Combine(Server.MapPath("~/Files"), FileUpload1.FileName);
    //save the file to our local path
    FileUpload1.SaveAs(fileName);
}

But in that, I want to give my physical path as I mentioned above. How to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:31:50+00:00Added an answer on June 3, 2026 at 5:31 pm

    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
        FileUpload1.SaveAs(fileName);
    }
    

    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);
        FileUpload1.SaveAs(fileName);
    
        FileInfo fileToDownload = new FileInfo( filename ); 
    
        if (fileToDownload.Exists){ 
            Process.Start(fileToDownload.FullName);
        }
        else { 
            MessageBox("File Not Saved!"); 
            return; 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo I want to make an file upload. The script should take the image,
asp.net provides file upload control.... now if i want to upload files on my
i want to upload a file to server and here is my code which
I want upload file without reload page. My server-side is ASP.NET MVC. Ext.Ajax.request( {
I want to upload file with have only file path in php. Can anyone
I want to upload a file to net server use the codes. but when
In my application I want to upload file from SD card to my server.
I want to upload a file to a ftp server programmatically (C++). If the
Hi i want to upload mulitiple file using rails 3 and paperclip please help
i want to upload the sound file (.ogg) in server. But it should write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.