2016-02-10 00:02:51 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
2017-10-06 18:28:06 +02:00
|
|
|
// $_POST
|
2018-04-13 23:32:29 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// (string) $_POST['path'] Name of file to delete, just the filename
|
|
|
|
$filename = isset($_POST['filename']) ? $_POST['filename'] : false;
|
|
|
|
// ----------------------------------------------------------------------------
|
2016-02-10 00:02:51 +01:00
|
|
|
|
2018-04-13 23:32:29 +02:00
|
|
|
if ($filename==false) {
|
2017-10-06 18:28:06 +02:00
|
|
|
exit (json_encode(array(
|
|
|
|
'status'=>1,
|
|
|
|
'message'=>'The filename is empty.'
|
|
|
|
)));
|
2016-02-10 00:02:51 +01:00
|
|
|
}
|
|
|
|
|
2017-10-06 18:28:06 +02:00
|
|
|
// Check if the filename exist
|
2018-04-13 23:32:29 +02:00
|
|
|
if (Sanitize::pathFile(PATH_UPLOADS.$filename)) {
|
|
|
|
Filesystem::rmfile(PATH_UPLOADS.$filename);
|
2017-10-06 18:28:06 +02:00
|
|
|
}
|
2016-02-10 00:02:51 +01:00
|
|
|
|
2017-10-06 18:28:06 +02:00
|
|
|
// Check if the file has a thumbnail
|
|
|
|
if (Sanitize::pathFile(PATH_UPLOADS_THUMBNAILS.$filename)) {
|
2016-02-10 00:02:51 +01:00
|
|
|
Filesystem::rmfile(PATH_UPLOADS_THUMBNAILS.$filename);
|
|
|
|
}
|
|
|
|
|
2017-10-06 18:28:06 +02:00
|
|
|
exit (json_encode(array(
|
|
|
|
'status'=>0,
|
|
|
|
'message'=>'File deleted.'
|
2016-09-26 04:30:06 +02:00
|
|
|
)));
|
2016-02-10 00:02:51 +01:00
|
|
|
|
|
|
|
?>
|