protected function load() { switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: $result = array('error' => JFactory::getLanguage()->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $um->Params =& $this->Params; $result = $um->HandleUpload(JPATH_COMPONENT . '/uploads/'); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
protected function load() { switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: // Malformed / malicious request, or attachment exceeds server limits $result = array('error' => JFactory::getLanguage()->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $um->Params =& $this->Params; $result = $um->HandleUpload(JPATH_COMPONENT . '/uploads/'); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
// @ avoids Warning: ini_set() has been disabled for security reasons in /var/www/libraries/joomla/[...] $lang = @JLanguage::getInstance($frontend_lang); @$lang->load($GLOBALS["com_name"]); switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: // Malformed / malicious request, or attachment exceeds server limits $result = array('error' => $lang->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $result = $um->HandleUpload('..' . DS . 'uploads' . DS, $lang); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); abstract class FUploadManager { protected $Params; protected $Session; protected $Log; protected $DebugLog; protected abstract function save_file($path); protected abstract function get_file_name(); protected abstract function get_file_size(); function __construct() { $this->Log = new FLogger(); $this->DebugLog = new FDebugLogger("file uploader");