You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
804 B

4 years ago
  1. <?php
  2. session_start();
  3. function xvar_dump ($x) {
  4. ob_start();
  5. var_dump($x);
  6. return ob_get_clean();
  7. }
  8. $jo = array();
  9. foreach ($_FILES as $key=>$files){
  10. for ($i=0; $i < count($files['name']); $i++){
  11. $tmpname = $files['tmp_name'][$i];
  12. $jo ["file-$key-$i"] = array(
  13. "url" => "url.txt",
  14. "name" => $files['name'][$i],
  15. "id" => $tmpname,
  16. "size" => sprintf("%0.1fK",$files['size'][$i]/1024.0)
  17. );
  18. $_SESSION['files'][$tmpname]['content']=
  19. file_get_contents($tmpname);
  20. $_SESSION['files'][$tmpname]['row']=$_GET['row'];
  21. }
  22. }
  23. $files = "";
  24. foreach ($_SESSION['files'] as $key => $val) {
  25. $files .= "$key\n";
  26. }
  27. $j = json_encode ($jo);
  28. echo $j;
  29. error_log("\n\n ----- files ----- \n\n$files\n\n\n");
  30. $xp = xvar_dump($_FILES);
  31. error_log("\n\n ----- FILES ----- \n\n$$xp\n\n\n");