<?php

require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$fileId = $_GET['fileId'];
SourceDesAttachmentManager::getInstance()->deleteFile($fileId, $current_user->user_id);
echo $fileId;
 private function __construct()
 {
     self::$attachment_dir = mnmpath . "sourceDesAttachments/";
 }
<?php

include_once realpath(dirname(__FILE__)) . '/FileManagers.php';
require_once realpath(dirname(__FILE__)) . '/../OriginalSmarty/OriginalSmarty.class.php';
$sid = $_POST['sid'];
$allowDeleteFiles = $_POST['allowDeleteFiles'];
$attachmentInfos = SourceDesAttachmentManager::getInstance()->getSourceAttachmentsInfo($sid);
// Assign model to template.
$smarty = new OriginalSmarty();
$smarty->assign('attachmentInfos', $attachmentInfos);
$smarty->assign('allowDeleteFiles', $allowDeleteFiles);
$smarty->display('attachmentList.tpl');
<?php

include_once realpath(dirname(__FILE__)) . '/FileManagers.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$userId = $current_user->user_id;
$sid = $_GET['sid'];
$description = trim($_POST['description']);
$fileMgr = SourceDesAttachmentManager::getInstance();
$listItemModel = $fileMgr->saveFile($sid, $userId, $_FILES['files'], $description);
$files[] = $listItemModel;
$fileList = array('files' => $files);
echo json_encode($fileList);
<?php

if (!isset($_GET['sid']) || is_int($_GET['sid'])) {
    die;
}
require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
require_once realpath(dirname(__FILE__)) . '/../OriginalSmarty/OriginalSmarty.class.php';
include_once realpath(dirname(__FILE__)) . '/../libs/login.php';
global $current_user;
if (!$current_user->authenticated) {
    die('Please login to use this function.');
}
$model = SourceDesAttachmentManager::getInstance()->createFileUploadPageModel();
// Assign model to template.
$smarty = new OriginalSmarty();
$smarty->assign('model', $model);
$smarty->assign('sid', $_GET['sid']);
$smarty->display('sourceAttachmentUploadPage.tpl');
<?php

require_once realpath(dirname(__FILE__)) . '/FileManagers.php';
$fileId = $_GET['fileId'];
$fileInfo = SourceDesAttachmentManager::getInstance()->downloadFile($fileId);
if ($fileInfo === null || !file_exists($fileInfo->path)) {
    die('File Not Found.');
}
header("Content-type:application");
header("Content-Length: " . $fileInfo->Size);
header("Content-Disposition: attachment; filename=" . $fileInfo->Title);
readfile($fileInfo->path);