Hi experts, I have a problem with downloading file.
Okay, my project is setup in IIS (pointing to the folder in my desktop) and my users are able to login, upload a file into the folder.
However, they are not able to download the file (except me).
How can I do that?
Please help. The following is my codes for uploading and downloading
//uploading
String projectID = (String)Session["projId"];
//change the file name
if (!FileUpload.FileName.Equals(""))
{
// Create a new folder in Docs folder (folder name = projectID)
System.IO.Directory.CreateDirectory(Server.MapPath("Docs/") + projectID + "/EP");
// Save the file into the new folder.
FileUpload.PostedFile.SaveAs(Server.MapPath("Docs/" + projectID + "/EP/" + FileUpload.FileName));
lblFile.Text = FileUpload.FileName + " is uploaded!";
lblFile.Visible = true;
}
//downloading
DirectoryInfo diSource = new DirectoryInfo(Server.MapPath("Docs/" + pid + "/" + shortForm + "/"));
string ExactFilename = string.Empty;
try
{
foreach (FileInfo file in diSource.GetFiles(@"*.*"))
{
ExactFilename = file.FullName;
System.Diagnostics.Process.Start(ExactFilename);
}
}
I understand that this is not "totally downloading a file".
I don't know the file format of each file my user has uploaded.