2
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 client fills in the fields:
The path is saved in the bank, and the photo would have to be added in the folder in question which is Featured:
What happens is that the image is saved right in the bank, but it is not being added in the folder and when the page is executed it appears only this:
I’m not able to write the right way, can anyone help me? Thanks in advance! : D
Which path appears on the page?
– Jéf Bueno