I have the following code:
protected void btnSalvarDestaque_Click(object sender, EventArgs e)
{
if (fuFotos.HasFile)
{
string strname = fuFotos.FileName;
fuFotos.PostedFile.SaveAs(Server.MapPath(".") + "//Content/Destaques//" + strname);
string path = "~/Content/Destaques/" + strname.ToString();
con.Open();
SqlCommand cmd = new SqlCommand("insert into Destaque values('" + txtTitulo.Text + "','" + txtValor.Text + "','" + strname + "')", con);
cmd.ExecuteNonQuery();
con.Close();
lblDestaque.Text = "Destaque cadastrado com sucesso!";
txtTitulo.Text = "";
txtValor.Text = "";
}
else
{
lblDestaque.Text = "Por favor selecione uma foto!";
}
}
The customer fills in the fields:
Thepathissavedtothebank,andthephotowouldhavetobeaddedtothefolderinquestionthatisHighlight:
Whathappensisthattheimagesavesrightonthebank,butitisnotbeingaddedtothefolderandwhenthepageisexecuteditonlyappears:
I do not know how to write the right way, can anyone help me? Thank you! : D