Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save files in F Drive how to take Server.Mappath("") address I am unable to save like this Server.Mappath("F:\Uploads"). uploads is folder in F drive.
Posted
Updated 15-Sep-11 22:38pm
v2

Hi,

Upto my knowledge you can access space under your website folder only

like ..
your website folder in c: drive thn you cannot access folder in f: drive

am I correct If wrong forgive me

I just tried what you said but it showing error like you've no permission to access
this file.

It was working by using following line

C#
FileUpload1.SaveAs(@"E:\sai/"+FileUpload1 .FileName );


but it is not correct way

b'coz webserver won't give permissions to do it
 
Share this answer
 
v3
Comments
jayanthik 16-Sep-11 4:58am    
tx
you can save as follows

fileuploadid.saveas("F:/uploads/"+fileuploadid.filename)


fileuploadid is id of file upload control
 
Share this answer
 
Comments
jayanthik 16-Sep-11 4:57am    
tx
You can use
C#
protected void UploadButton_Click(object sender, EventArgs e)
  {
    // Specify the path on the server to
    // save the uploaded file to.
    String savePath = @"F:\";

    // Before attempting to perform operations
    // on the file, verify that the FileUpload
    // control contains a file.
    if (FileUpload1.HasFile)
    {
      // Get the name of the file to upload.
      String fileName = FileUpload1.FileName;

      // Append the name of the file to upload to the path.
      savePath += fileName;


      // Call the SaveAs method to save the
      // uploaded file to the specified path.
      // This example does not perform all
      // the necessary error checking.
      // If a file with the same name
      // already exists in the specified path,
      // the uploaded file overwrites it.
      FileUpload1.SaveAs(savePath);
    }
    else
    {
    // Show user haven't specified any file
    }


For more reference you can take a look there-MSDN-[FileUpload Class][^]
 
Share this answer
 
Comments
Md. Rayhan Kabir 18-Nov-11 0:47am    
how to get full path of a selected file ?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900