title: HttpPostedFileBase to byte array make exception
body: <p>I am using mvc 4</p>
  
  <p>i have this model : <code>ViewModelOne</code></p>
  
  <pre><code>public HttpPostedFileBase passportImage { get; set; }
  </code></pre>
  
  <p>Also, I have this model: <code>modelViewTWO</code></p>
  
  <pre><code>public byte[] passportImage { get; set; }
  </code></pre>
  
  <p>I have this View witch use ViewModelOne as a model</p>
  
  <pre><code>@Html.TextBoxFor(model =&gt; model.passportImage, new { placeholder = "Uploadt Your Passport", type = "file"})
  </code></pre>
  
  <p>I have this controller:</p>
  
  <pre><code>public string Register(ViewModelOne newT) {
  modelViewTWO second = new modelViewTWO();
  byte[] data;
              using (Stream inputStream = newT.passportImage.InputStream)
              {
                  MemoryStream memoryStream = inputStream as MemoryStream;
                  if (memoryStream == null)
                  {
                      memoryStream = new MemoryStream();
                      inputStream.CopyTo(memoryStream);
                  }
                  data = memoryStream.ToArray();
              }
              second.passportImage = data;
  }
  </code></pre>
  
  <p>I got this exception</p>
  
  <p><strong>Object reference not set to an instance of an object.</strong></p>
  
  <p>in this line</p>
  
  <pre><code>newT.passportImage.InputStream
  </code></pre>
  
  <h3>Edit</h3>
  
  <p>I check that newT.passportImage and It is null. why?</p>