Changeset 523 for trunk/lib/Upload.inc.php
- Timestamp:
- May 24, 2015 3:01:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Upload.inc.php
r519 r523 80 80 81 81 if (isset($params) && is_array($params)) { 82 83 82 // Enforce valid upload_path parameter. 84 83 if (isset($params['upload_path'])) { 85 $upload_path = realpath($params['upload_path']);86 84 // Source must be directory. 87 if (!is_dir($ upload_path)) {88 $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $ upload_path), LOG_NOTICE, __FILE__, __LINE__);89 if (version_compare(PHP_VERSION, '5.0.0', '>=')) {90 // Recursive.91 mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);85 if (!is_dir($params['upload_path'])) { 86 $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__); 87 mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true); 88 if (is_dir($params['upload_path'])) { 89 $app->logMsg(sprintf('Created upload directory: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 92 90 } else { 93 mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms')); 94 } 95 if (!is_dir($upload_path)) { 96 $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 97 trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR); 91 $app->logMsg(sprintf('Upload directory not found: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 92 trigger_error(sprintf('Upload directory not found: %s', $params['upload_path']), E_USER_ERROR); 98 93 } 99 94 } 100 95 // Source must be writable. 101 if (!is_writable($ upload_path)) {96 if (!is_writable($params['upload_path'])) { 102 97 $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 103 98 trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR); … … 189 184 if ('' == trim($files['name'][$i])) { 190 185 // User may not have attached a file. 186 $app->logMsg(sprintf('Skipping file %s with empty name', $i), LOG_DEBUG, __FILE__, __LINE__); 191 187 continue; 192 188 }
Note: See TracChangeset
for help on using the changeset viewer.