本文整理汇总了PHP中FileManager::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::upload方法的具体用法?PHP FileManager::upload怎么用?PHP FileManager::upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::upload方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Response
return @file_get_contents($localPath);
}
}
}
ExceptionCatcherJSON::register();
$oResponse = new Response();
$oFtp = new FileManager(array('hostname' => '', 'username' => '', 'password' => ''));
if (!$oFtp->connect()) {
throw new Exception("Cannot connect to the FTP server");
}
if (Request::getFile() && ($dest = Request::getPost('destination'))) {
$errors = array();
foreach (Request::getFile() as $file) {
$filePath = $file['tmp_name'];
$destPath = $dest . '/' . $file['name'];
$result = $oFtp->upload($filePath, $destPath);
if (!$result) {
$errors[] = $file['name'];
}
}
if ($errors) {
throw new Exception("Unknown error uploading: \n\n" . implode(", \n", $errors));
}
$oResponse->setData($result);
$oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'list') {
$list = $oFtp->listFilesRaw(Request::getApiParam('path'));
$list = is_array($list) ? $list : array();
$list = array_map(function ($item) {
$date = new \DateTime('now');
示例2: die
* CubeCart is a registered trade mark of CubeCart Limited
* Copyright CubeCart Limited 2015. All rights reserved.
* UK Private Limited Company No. 5323904
* ========================================
* Web: http://www.cubecart.com
* Email: sales@cubecart.com
* License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
*/
if (!defined('CC_INI_SET')) {
die('Access Denied');
}
Admin::getInstance()->permissions('settings', CC_PERM_READ, true);
global $lang;
if (isset($_POST['gc']) && is_array($_POST['gc']) && Admin::getInstance()->permissions('settings', CC_PERM_EDIT)) {
$filemanager = new FileManager(FileManager::FM_FILETYPE_IMG);
if (($uploaded = $filemanager->upload()) !== false) {
foreach ($uploaded as $file_id) {
$_POST['image'][(int) $file_id] = true;
}
}
if (isset($_POST['image']) && is_array($_POST['image'])) {
$gc = $GLOBALS['config']->get('gift_certs');
foreach ($_POST['image'] as $image_id => $enabled) {
if ($enabled == 0) {
if ($image_id == $gc['image']) {
$_POST['gc']['image'] = '';
}
continue;
}
$_POST['gc']['image'] = (int) $image_id;
break;
示例3: isset
}
} else {
$mode = FileManager::FM_FILETYPE_IMG;
}
$subdir = isset($_GET['subdir']) ? urldecode($_GET['subdir']) : '';
$fm = new FileManager($mode, $subdir);
if (isset($_GET['rebuild']) && Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT)) {
if ($fm->buildDatabase()) {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_list_update']);
} else {
# $GLOBALS['main']->setACPWarning($lang['filemanager']['error_list_update']);
}
httpredir(currentPage(array('rebuild')));
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT) && !empty($_FILES)) {
if ($fm->upload()) {
if (count($_FILES) > 1) {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_files_upload']);
} else {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_upload']);
}
} else {
$GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_upload']);
}
httpredir(currentPage());
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_DELETE) && isset($_GET['delete'])) {
if ($fm->delete($_GET['delete'])) {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_delete']);
} else {
$GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_delete']);
示例4: die
if (!defined('CC_INI_SET')) {
die('Access Denied');
}
Admin::getInstance()->permissions('categories', CC_PERM_READ, true);
global $lang;
###########################################
## Update/Insert a category
if (isset($_POST['cat']) && is_array($_POST['cat']) && Admin::getInstance()->permissions('categories', CC_PERM_EDIT)) {
foreach ($GLOBALS['hooks']->load('admin.category.save.pre_process') as $hook) {
include $hook;
}
$redirect = true;
$keys_remove = null;
$keys_add = null;
$filemanager = new FileManager(FileManager::FM_FILETYPE_IMG);
if (($uploaded = $filemanager->upload()) !== false && is_array($uploaded)) {
foreach ($uploaded as $file_id) {
$_POST['image'][(int) $file_id] = true;
}
}
foreach ($_POST['cat'] as $key => $value) {
if (!in_array($key, array('cat_name'))) {
continue;
}
$_POST['cat'][$key] = html_entity_decode($value);
}
$_POST['cat']['hide'] = (int) $_POST['cat']['visible'] && (int) $_POST['cat']['status'] ? 0 : 1;
$_POST['cat']['cat_desc'] = $GLOBALS['RAW']['POST']['cat']['cat_desc'];
if (is_numeric($_POST['cat']['cat_id'])) {
$cat_id = $_POST['cat']['cat_id'];
$old_image = $GLOBALS['db']->select('CubeCart_category', array('cat_image'), array('cat_id' => $_POST['cat']['cat_id']));