Newer
Older
<?php
include 'config.php';
include 'session-service.php';
$validation = checkRequest(['fileId']);
if ($validation !== true){
exit(json_encode($payload));
}
$filePath = $assetsDir.'/docs'.$_POST['fileId'];
if (!file_exists($filePath) || is_dir($filePath)){
$payload = [
'success' => false,
exit(json_encode($payload));
}
$file = json_decode(file_get_contents($filePath));
$payload = [
'success' => true,
'file' => $file
];