title: AngularJS: Receiving posted data while file uploading
body: <p>My current scenario is: I've doing nesting repetition like follow:</p>
  
  <pre><code>$scope.uploadPic = function(file) 
  {
  
      alert($scope.taskdetails.id);       //task_id e.g 21
      alert($rootScope.job_id);   //job_id e.g 12
      file.upload = Upload.upload(
      {
        url: 'http://localhost/mobile-data/upload_file.php',
        data: {
                  file: file,
                  task_id: $scope.taskdetails.id,
                  job_id: $rootScope.job_id
              },
  
      });
      file.upload.then(function (response) {
        $timeout(function () {
          file.result = response.data;
        });
      }, function (response) {
        if (response.status &gt; 0)
          $scope.errorMsg = response.status + ': ' + response.data;
      }, function (evt) {
        // Math.min is to fix IE which reports 200% sometimes
        file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
      });
  }   
  </code></pre>
  
  <p>but on my <code>upload_file.php</code> i can't receive the values for:</p>
  
  <pre><code>task_id: $scope.taskdetails.id,
  job_id: $rootScope.job_id
  </code></pre>
  
  <p>in <code>console.log</code> they are working fine. but on server side it is not receiving.
  here is code of my <code>upload_file.php</code></p>
  
  <pre><code>header('Access-Control-Allow-Origin: *');
  header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
  header('content-type: application/json; charset=utf-8');
  $_POST = json_decode(file_get_contents('php://input'), true);
  
  $task_id = $_POST["task_id"];
  $file = $_FILES["file"];
  $job_id = $_POST["job_id"];
  var_dump($task_id);
  var_dump($job_id);
  </code></pre>
  
  <p>but on <code>var_dump</code> it only print <code>null</code>. Help me to receive the values correctly..</p>