Hi I am new to .net have a few questions from a (visual 6 type, c++ directx prepective) to a (2008 express edition C#, .net prepective)
My list box is not doing what I thought it would do, I wanted a list box that would give me a list of all my files uploaded in a session, however It only gives me the very last file I uploaded and not all of the files in this session when post back happens. I would like to know what the functions are doing, since what I thought the functions would do did not occour, therefore I most have missed a step; likewise, I would like to know what that step does at least that way I may better understand the .net functions,
ps, does anyone know of a book or website that has a perpective of (visual 6 type, c++ directx) to a perpective to a (2008 express edition C#, .net perpective), I understand COM by using directx for so long in c++, but it seems most webstes and books do not teach from that perpective. Any way here is my code, I should be back on this site at 12'o clock after I deal with some clients if in case any one has some questions about the code posted, becuase I sure do.
protected void Page_Load(object sender, System.EventArgs e)
{
string UpPath;
UpPath =
"C:\\UploadedUserFiles";if (!Directory.Exists(UpPath))
{
Directory.CreateDirectory("C:\\UploadedUserFiles\\");
}
}
protected void Upload_Click(object sender, EventArgs e)
{
if (!File_Upload.HasFile)
return;string strFileName;
strFileName = File_Upload.PostedFile.FileName;
string c = System.IO.Path.GetFileName(strFileName);
try
{
File_Upload.PostedFile.SaveAs("C:\\UploadedUserFiles\\" + c);
}
catch (Exception Handle_error)
{
// Not sure what I what to do here, but the try works anyway
}
ArrayList filesArray;
// this session object ["List_Uploads"] is declared in Global.asax as a null in Session_Startif (Session["List_Uploads"] == null)
{
filesArray = new ArrayList();
}
else
{
filesArray = (ArrayList)Session["List_Uploads"];
}
filesArray.Add(File_Upload.FileName);
ShowUpLoads_List.DataSource = filesArray;
ShowUpLoads_List.DataBind();
}