title: Angular JS couldn't send form data with file-data together
body: <p>Novice in angularjs. I have a form in which one input field have type file. Remaining all are text and select fields. I want, when i submit form, all form data including file data should post together. Here is my code, please review.</p>
  
  <p>//html</p>
  
  <pre><code>&lt;input type="file" name="student_image" onchange="angular.element(this).scope().uploadFile(this.files)" ng-model="formData.studentImage" id="student_image"&gt;
  </code></pre>
  
  <p>//JS</p>
  
  <pre><code>var from_data = new FormData();
  $scope.uploadFile = function (files) {
          from_data.append("file", files[0]);
  };
  $scope.submit = function () {
          from_data.append('fullname',$scope.formData.studentFullname);
          from_data.append('fullname',$scope.formData.studentEmail);
          from_data.append('class',$scope.formData.studentClass);
          $http({
              method: 'POST',
              url: 'process.php',
              enctype: 'multipart/form-data',
              processData: false,
              data: from_data, // pass in data as strings
              headers: {'Content-Type': false}  // set the headers so angular passing info as form data (not request payload)
          }).success(function (data) {
              console.log(data);
          });
      };
  </code></pre>