* @package MCMS\Components */ class JUpload extends MObject implements \MCMS\Component\iComponent { const VERSION = '6.0.2'; const MAX_CHUNK_SIZE = 262144; const MODE_FILES = 'files'; const MODE_IMAGES = 'images'; const LOG_SHOW = 'true'; const LOG_ONERROR = 'onError'; const LOG_HIDE = 'false'; private $target = NULL; public $use_chunks = false; public $mode = self::MODE_FILES; public $name = 'JApplet'; public $width = 600; public $height = 400; public $debug = false; public $showLogWindow = self::LOG_ONERROR; public function setTarget($targetURL) { $this->target = $targetURL; } public function getTarget() { return $this->target; } public function getCode(array $param = array()) { $base = _COMURL_ . '/mcms/html/upload/jupload/_bin_'; $maxsize = trim(ini_get('upload_max_filesize')); $last = strtolower($maxsize[strlen($maxsize) - 1]); switch($last) { case 'g': $maxsize *= 1024; case 'm': $maxsize *= 1024; case 'k': $maxsize *= 1024; } /* other known parameters ---------------------- language: de country: afterUploadURL: null allowHttpPersistent: false allowedFileExtensions: null browsingDirectory (current value): null debugLevel: 100 (debugfile: D:\Users\kiu345\AppData\Local\Temp\jupload_7278030391554327573_log.txt) fileChooserIconFromFileContent: 0 fileChooserIconSize: 20 fileFilterName: null filenameEncoding: null formdata: null ftpCreateDirectoryStructure: false ftpTransfertBinary: true ftpTransfertPassive: true httpUploadParameterName: File httpUploadParameterType: array lang: null maxChunkSize: 9223372036854775807 maxFileSize: 4194304 nbFilesPerRequest: 1 readCookieFromNavigator: true readUserAgentFromNavigator: true retryMaxNumberOf: 1 retryNbSecondsBetween: 30 sendMD5Sum: false serverProtocol: HTTP/1.1 showLogWindow: true showStatusbar: true specificHeaders: null Headers that will be added to the POST request: stringUploadError: ^ERROR: (.*)$ stringUploadSuccess: ^SUCCESS$ stringUploadWarning: ^WARNING: (.*)$ */ $params = array( // 'urlToSendErrorTo' => '', 'debugLevel' => ($this->debug ? 100 : 0),'scriptable' => 'true', 'mayscript' => 'false','postURL' => $this->target,'maxFileSize' => $maxsize, 'showLogWindow' => $this->showLogWindow,'lookAndFeel' => 'system', 'maxChunkSize' => ($this->use_chunks ? self::MAX_CHUNK_SIZE : 0), 'httpUploadParameterType' => 'array'); if($this->mode == self::MODE_IMAGES) $params['uploadPolicy'] = 'PictureUploadPolicy'; $paramstring = ''; foreach($params as $key=>$value) { $paramstring .= "\t" . '' . "\n"; } $emedstring = ''; foreach($params as $key=>$value) { $emedstring .= "\t\t\t" . $key . '="' . $value . '"' . "\n"; } $st = ' ' . $paramstring . ' No Java Support. '; return $st; } }