title: fileupload.PostedFile.SaveAs not save image in folder in asp.net
body: <pre><code>string fileName = Path.GetFileName(fup.PostedFile.FileName);
  fileName = Guid.NewGuid() + fileName;
  
  if (Path.GetExtension(fup.PostedFile.FileName) == ".jpg" || Path.GetExtension(fup.PostedFile.FileName) == ".jpeg" || Path.GetExtension(fup.PostedFile.FileName) == ".bmp" || Path.GetExtension(fup.PostedFile.FileName) == ".png")
  {
      string s = Server.MapPath("~/Images/" + fileName);
      fup.PostedFile.SaveAs(s);
      how = "file";
  
      SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString);
      SqlCommand cmd = new SqlCommand(@"update product set sub_cat = '" + ddlcategory.SelectedValue.Trim() + "',name='" + Pnam.Text.Trim() + "',pic='" + fileName + "',price=" + price.Text.Trim() + ",description='" + desc.Text.Trim() + "',unit='" + ddlUnit.SelectedValue.Trim() + "',catgeory='" + ddlcat.SelectedValue.Trim() + "'  where product_id=" + pid.Text.Trim(), cn);
      cn.Open();
      cmd.ExecuteNonQuery();
      cn.Close();
      gvproduct.EditIndex = -1;
      fillgrid();
  
      show = "Update";
  }
  </code></pre>
  
  <p>This is my code to save image file in Images(folder). After execution this query  no image is save in folder. But these images show in <code>GridView</code>,
  which code is like this:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Image"&gt;
    &lt;ItemTemplate&gt;
        &lt;asp:Image ID="imgPd" runat="server" Height="60px"
            ImageUrl='&lt;%#"~/Images/"+Eval("pic").ToString() %&gt;' Width="60px" /&gt;
    &lt;/ItemTemplate&gt;
    &lt;EditItemTemplate&gt;
        &lt;asp:FileUpload ID="FileUploadGV" runat="server" Width="50px" /&gt;
  </code></pre>