Никак не мог найти часть тропинки 'E:\\highlighted\\highlighted\\db\\'
я хочу загрузить свой файл в динамически создаваемый каталог. и хотите скачать файлы в разных разных папках с именем версии .Есть ли возможность загрузить несколько файлов в разные папки при выборе флажка .
первый приоритет для загрузки данных в папки
Что я уже пробовал:
foreach (GridViewRow row in grdCustomer.Rows) { var isChecked = (row.FindControl("CheckBox1") as CheckBox); if (isChecked.Checked) { string filename = (row.FindControl("lblFileName") as HyperLink).Text; byte[] bytes; string fileName, contentType, version; string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select uploadfilename,filename, Description, version,ContentType from upload_test where filename=@filename"; cmd.Parameters.AddWithValue("@filename", filename); cmd.Connection = con; con.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { sdr.Read(); bytes = (byte[])sdr["Description"]; contentType = sdr["ContentType"].ToString(); fileName = sdr["uploadfilename"].ToString(); version = sdr["version"].ToString(); // string dateString = DateTime.Now.ToString(""); } } //string path = HttpContext.Current.Server.MapPath("~/" + version + "/"); //Directory.CreateDirectory(path); ////FileAttributes att = File.GetAttributes(path); ////File.SetAttributes(path,att); //DirectorySecurity sec = Directory.GetAccessControl(path); //var appDataPath = Server.MapPath("~/db/"); //if (!Directory.Exists(appDataPath)) //{ // Directory.CreateDirectory(appDataPath); //} Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = contentType; Response.AppendHeader("Content-Disposition", string.Format("attachment; filename={0}", filename)); Response.BinaryWrite(bytes); //string id = path + filename + contentType; Response.TransmitFile(HttpContext.Current.Server.MapPath("~/db/")); //Response.WriteFile(path); Response.End();