title: What type of data should be passed from Angular 2 which matches type HttpPostedFileBase type in Asp Net MVC?
body: <p>I have a HTML code which ask for an upload of image file:</p>
  
  <pre><code> &lt;input (change)="onSubmit($event)"  type="file" ... .... accept="image/*" /&gt; //Assume the correct bindings for value
  </code></pre>
  
  <p>And the value/path is stored in a string variable named <code>path</code> in corresponding ts file. The value of <code>path</code> variable is then sent to api controller's post method:</p>
  
  <pre><code>@Component({
     ...
     ...
  })
  
  export class UpdateProduct implements OnInit {
        path:string;
  
        onSubmit(form){
            this.path=form.target.value;
            //logic for http post-I am sending the value to api controller
          }
      }
  </code></pre>
  
  <p>My api controller:</p>
  
  <pre><code>    [HttpPost]
      [ResponseType(typeof(ProductUpdates))]
      public IHttpActionResult PostProductUpdates(string path)
      {
      }
  </code></pre>
  
  <p>I want to retrieve the image and store in a temp folder here. For the same I searched on internet and found this piece of code:</p>
  
  <pre><code>var FileName = Path.GetFileName(path);
              var map=Path.Combine(HttpContext.Current.Server.MapPath("/Image Database")); //My temp folder
              file.SaveAs(Path.Combine(map, FileName));
  </code></pre>
  
  <p>where object <code>file</code> is the object of HTTPPostedFileBase. Here I get null reference exception since there is no value provided to it.</p>
  
  <p>Having quoted the scenario, here are <strong>my questions</strong>:</p>
  
  <ol>
  <li>Is my approach correct to upload an image and send its path to api controller for retrieving the image and saving it in temp folder? (Since browsers allots fakepaths)</li>
  <li>Is there any datatype to save blob, HTTPPostedFileBase or file type variables in angular 2?</li>
  <li>What is the simplest way to store image in temp folder whose client side is written in Angular 2 and server side is linked with api controller?</li>
  </ol>