function download_attachment() { $fileName = JRequest::getVar('filename', ''); $originalFilename = JRequest::getVar('original_filename', ''); if (file_exists(JPATH_ROOT . '/media/com_helpdeskpro/attachments/' . $fileName)) { while (@ob_end_clean()) { } HelpdeskProHelper::processDownload(JPATH_ROOT . '/media/com_helpdeskpro/attachments/' . $fileName, $originalFilename); exit; } else { $mainframe =& JFactory::getApplication(); $mainframe->redirect('index.php', JText::_('HDP_FILE_NOT_EXIST')); } }