0
Answer

Using a dropdown list as a save location

Chris Buchan

Chris Buchan

15y
2.7k
1
Hey, First off i am pretty new to c# so i am sorry if this is a simple question. I am running VWD2008 to make a web page and i have a page based on c#. I am trying to upload files to our sever but i would like a way to choose different folders to save the files. At the momment my code looks like this: using System; using System.Web.UI.WebControls; public partial class Management_FileUpload : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { ////saving file in the physical folder; FileUpload FileUpload1 = file_Image; DropDownList Droplist2 = DropList1; string virtualFolder = "~/" + Droplist2 + "/"; string physicalFolder = Server.MapPath(virtualFolder); FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName); lbl_Result.Text = "Your file " + FileUpload1.FileName + " has been uploaded."; In my webpage, my dropdownlist is called dropList1 I would like to be able to save my selected file to "~/(what ever folder i select from my list) /File name Hope this makes sence :)