wmdeit_kaform/upload.php

55 lines
944 B
PHP
Raw Permalink Normal View History

2020-02-20 13:45:47 +00:00
<?php
session_start();
function xvar_dump ($x) {
ob_start();
var_dump($x);
return ob_get_clean();
}
$jo = array();
foreach ($_FILES as $key=>$files){
for ($i=0; $i < count($files['name']); $i++){
$tmpname = $files['tmp_name'][$i];
2020-09-18 14:18:08 +00:00
$ft = mime_content_type($tmpname);
if ($ft != "application/pdf"){
$jo = array(
"type" => "error"
);
} else {
$jo ["file-$key-$i"] = array(
"url" => "url.txt",
"name" => $files['name'][$i],
"id" => $tmpname,
"size" => sprintf("%0.1fK",$files['size'][$i]/1024.0)
);
}
2020-02-20 13:45:47 +00:00
$_SESSION['files'][$tmpname]['content']=
file_get_contents($tmpname);
$_SESSION['files'][$tmpname]['row']=$_GET['row'];
}
}
$files = "";
foreach ($_SESSION['files'] as $key => $val) {
$files .= "$key\n";
}
$j = json_encode ($jo);
echo $j;
2020-09-18 14:18:08 +00:00
#error_log("\n\n ----- files ----- \n\n$files\n\n\n");
#$xp = xvar_dump($_FILES);
#error_log("\n\n ----- FILES ----- \n\n$$xp\n\n\n");
2020-02-20 13:45:47 +00:00