protected void btn_upload_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { string fileName = FileUpLoad1.FileName; string Ruta1; Ruta1 = Server.MapPath(ConfigurationManager.AppSettings["conductores_yms"]); if (!System.IO.Directory.Exists(Ruta1)) { System.IO.Directory.CreateDirectory(Ruta1); } if (Path.GetExtension(FileUpLoad1.FileName) == ".png" || Path.GetExtension(FileUpLoad1.FileName) == ".jpg") { ConductorBC c = new ConductorBC(); c = c.ObtenerXId(Convert.ToInt32(hf_id.Value)); string sName = "COND_" + c.RUT + Path.GetExtension(FileUpLoad1.FileName); try { FileUpLoad1.SaveAs(Ruta1 + sName); c.IMAGEN = sName; if (c.AgregarFoto()) { utils.ShowMessage2(this, "subirFoto", "success"); ObtenerConductores(true); } else { utils.ShowMessage2(this, "subirFoto", "error"); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } } else { utils.ShowMessage2(this, "subirFoto", "warn_archivoInvalido"); } } }