title: MVC || HTML Form || Object reference not set to an instance of an object
body: <p>I get this error and i dont know how to over come it:</p>
  
  <p>"Object reference not set to an instance of an object."</p>
  
  <pre><code>Line 48:         public ActionResult Upload(imageFile imageFile)
  Line 49:         {
  Line 50:             foreach (var image in imageFile.files)
  Line 51:             {
  Line 52:                 if (image.ContentLength &gt; 0)
  </code></pre>
  
  <p>I tried using ID attribute and name attribute and what not...</p>
  
  <p>This is the problematic section in my controller :</p>
  
  <pre><code>     [HttpPost]
      public ActionResult Upload(imageFile imageFile)
      {
          foreach (var image in imageFile.files)
          {
              if (image.ContentLength &gt; 0)
              {
                  CloudBlobContainer blobContainer = _blobStorageService.GetCloudBlobContainer();
                  CloudBlockBlob blob = blobContainer.GetBlockBlobReference(image.FileName);
                  blob.UploadFromStream(image.InputStream);
              }
          }
          return RedirectToAction("Upload");
      }
  </code></pre>
  
  <p>This is the HTML.Form :</p>
  
  <pre><code>&lt;p&gt;
      @using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
      {
          &lt;input type="file" name="imageFile" id="imageFile" multiple /&gt;
          &lt;input type="submit" name="submit" value="Upload" /&gt;
      }
  &lt;/p&gt;
  </code></pre>
  
  <p>And this is the "imageFile" class :</p>
  
  <pre><code>public class imageFile
  {
      public IEnumerable&lt;HttpPostedFileBase&gt; files { get; set; }
  }
  </code></pre>
  
  <p>What i'm doing wrong ? i read a lot of posts about this exception but none of them helped me..</p>
  
  <p>Thank you.</p>