<?php
$rawData = file_get_contents("php://input");
 echo "<hr/>-----file_get_contents(php://input)<br/>";
var_dump($rawData);
 echo "<hr/>-----json_decode<br/>";
$obja=json_decode($rawData);
 
var_dump($obja);
 echo "<hr/>-----_POST<br/>";
     print_r($_POST);
    echo "<hr/>-----_REQUEST['test']<br/>";
    print_r($_REQUEST['test']);
 echo "<hr/>-----_FILES<br/>";
    print_r($_FILES);
 foreach ($_FILES as $file) { 
 //print_r($file); echo "<hr/>";
   echo "<hr/>$_FILES as $file<br/>";
   if (strlen($file['tmp_name']) > 0 and $file['error'] === UPLOAD_ERR_OK) { 
         $source_file = $file["tmp_name"];
         $target_file = $file["name"];
         $file_size = $file["size"];
         echo sprintf("Uploaded file '%s' accepted\n",$target_file);
         echo "Size was: " . display_filesize($file_size / 1024) . "\n";
   }
 }
 
 
 function display_filesize($filesize){
   if(is_numeric($filesize)){
      $decr = 1024; $step = 0;
      $prefix = array('Byte','KB','MB','GB','TB','PB');

      while(($filesize / $decr) > 0.9){
         $filesize = $filesize / $decr;
         $step++;
      } 
      return round($filesize,2).' '.$prefix[$step];
   } else {
      return 'NaN';
   }
}
?>
