title: Can't receive files from client side in asp.net using C#
body: <p>I'm trying to get a profile image from a form.  The html looks like this:</p>
  
  <pre><code>&lt;form action="UpdateProfile.aspx" method="post"&gt;
    &lt;input type='file' name='profilePic'/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The server side code looks like this: </p>
  
  <pre><code>HttpPostedFile image = Request.Files["profilePic"];
  string imagePath = @"../Pictures/Profile/DefaultPicture.png";
  if (image.ContentLength &gt;0 &amp;&amp; image != null)
  {
     if (Path.GetExtension(image.FileName) == "jpg" || Path.GetExtension(image.FileName) == "jpeg" ||
         Path.GetExtension(image.FileName) == "png" || Path.GetExtension(image.FileName) == "gif" ||
         Path.GetExtension(image.FileName) == "bmp")
     {
         string fileExtention = Path.GetExtension(image.FileName);
         string FileName = Session["Username"].ToString() + "." + fileExtention;
         image.SaveAs(Server.MapPath(Path.Combine("../Pictures/Profile/", FileName)));
         imagePath = Path.Combine("../Pictures/Profile/", FileName);
     }
  }
  </code></pre>
  
  <p>But it never works, no matter what I upload the <code>image</code> variable is always <code>null</code>. 
  its like the server cant recive it or something. can you guys help me solve it or tell me where i went wrong? Thank you in advance. </p>