Example #1
0
 /**
  * Process download a file
  */
 public function download_file()
 {
     $Itemid = JRequest::getInt('Itemid');
     $filePath = 'media/com_osmembership/upload';
     $fileName = JRequest::getVar('file_name', '');
     if (file_exists(JPATH_ROOT . '/' . $filePath . '/' . $fileName)) {
         while (@ob_end_clean()) {
         }
         OSMembershipHelper::processDownload(JPATH_ROOT . '/' . $filePath . '/' . $fileName, $fileName, true);
         exit;
     } else {
         JFactory::getApplication()->redirect('index.php?option=com_osmembership&Itemid=' . $Itemid, JText::_('OSM_FILE_NOT_EXIST'));
     }
 }