本文整理汇总了PHP中Includes\Utils\FileManager::moveUploadedFileByMultiple方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::moveUploadedFileByMultiple方法的具体用法?PHP FileManager::moveUploadedFileByMultiple怎么用?PHP FileManager::moveUploadedFileByMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::moveUploadedFileByMultiple方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCustomImages
/**
* Update custom images
*
* @return void
*/
protected function updateCustomImages()
{
$dir = \XLite\Module\XC\ThemeTweaker\Main::getThemeDir() . 'images' . LC_DS;
if ($_FILES && $_FILES['new_images'] && $_FILES['new_images']['name']) {
if (!\Includes\Utils\FileManager::isExists($dir)) {
\Includes\Utils\FileManager::mkdirRecursive($dir);
}
if (\Includes\Utils\FileManager::isDirWriteable($dir)) {
foreach ($_FILES['new_images']['name'] as $i => $data) {
\Includes\Utils\FileManager::moveUploadedFileByMultiple('new_images', $i, $dir);
}
} else {
\XLite\Core\TopMessage::addError('The directory {{dir}} does not exist or is not writable.', array('dir' => $dir));
}
}
$delete = \XLite\Core\Request::getInstance()->delete;
if ($delete && is_array($delete)) {
foreach ($delete as $file => $del) {
if ($del) {
\Includes\Utils\FileManager::deleteFile($dir . $file);
}
}
}
}
示例2: loadFromMultipleRequest
/**
* Load from multiple request
*
* @param string $key Key in $_FILES service array
* @param integer $position Position in multiple $_FILES service array
*
* @return boolean
*/
public function loadFromMultipleRequest($key, $position)
{
$path = \Includes\Utils\FileManager::moveUploadedFileByMultiple($key, $position, $this->getStoreFileSystemRoot());
if ($path) {
$this->setStorageType(static::STORAGE_RELATIVE);
if ('' != $_FILES[$key]['type'][$position]) {
$this->setMime($_FILES[$key]['type'][$position]);
}
if (!$this->savePath($path)) {
\Includes\Utils\FileManager::deleteFile($path);
$path = null;
}
} else {
\XLite\Logger::getInstance()->log('The file was not loaded', LOG_ERR);
}
return !empty($path);
}