本文整理汇总了PHP中FileUploader::move方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUploader::move方法的具体用法?PHP FileUploader::move怎么用?PHP FileUploader::move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUploader
的用法示例。
在下文中一共展示了FileUploader::move方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
if (!$_SESSION['webmaster']) {
header("location:login.php");
}
require_once '../common.php';
require_once ROOT_PATH . '/include/FileUploader.class.php';
$exptimes = array('2592000' => '一个月', '5184000' => '两个月', '7776000' => '三个月', '10368000' => '四个月', '12960000' => '五个月', '15552000' => '六个月', '18144000' => '七个月', '20736000' => '八个月', '23328000' => '九个月', '25920000' => '十个月', '28512000' => '十一个月', '31104000' => '十二个月');
$adlocations = array('A' => '首页顶部A(680*70)', 'B' => '首页头部B(430*220)', 'C' => '首页头部C(210*220)', 'D' => '首页中间D(920*120)', 'E' => '首页中间E(655*120)', 'F' => '首页中间F(257*120)', 'G' => '首页中间G(655*50)', 'H' => '首页底部H(257*120)', 'T' => '首页头部T(文字广告)');
if ($action == 'save' && !empty($title) && !empty($url)) {
$name = m_addslashes($title);
$url = trim($url);
$file = $_FILES['img'];
//文件上传时注意enctype="multipart/form-data"
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['img']);
$pic = $uf->move(ROOT_PATH . '/adsimg', 2);
$img = $pic[0] ? get_basename($pic[0]) : 'NULL';
} elseif ($isimgad) {
refer('您选择的是图片广告,但您未选择上传图片!');
}
$db->query("INSERT INTO `advertising` VALUES (NULL,'{$adlocation}','{$title}','{$img}','{$isimgad}','{$url}',now(),'{$exptime}')") or error('Unable to add advertising', __FILE__, __LINE__, $db->error());
updateAdsCache();
refer('添加成功');
}
if ($action == 'del' && isset($id)) {
$query_id = $db->query("SELECT img FROM `advertising` WHERE id = {$id}");
$result = $db->fetch_array($query_id);
$img = $result['img'];
if ($img) {
@unlink(ROOT_PATH . '/adsimg/' . $img);
}
示例2: FileUploader
$title = format_content($_POST['name']);
$suggest = $_POST['suggest'];
$content = format_content($_POST['content']);
$file = $_FILES['uploadpic'];
$author = $_SESSION['adminname'];
/*
if(empty($name) || empty($p_xilie)){
refer('文章名称和文章系列不能为空!');
}elseif((!preg_match("/[0-9]{,4}/i",$price) && !empty($price)) || (!preg_match("/[0-9]{,4}/i",$p_num) && !empty($p_num))){
refer('文章价格和数量只能是数值,请重新填写!');
}*/
// print_r($file);
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['uploadpic']);
$pic = $uf->move(ROOT_PATH . 'article_upimg', 2);
$uppic = $pic[0] ? get_basename($pic[0]) : 'NULL';
$img = new image(ROOT_PATH . 'article_upimg/' . $uppic);
//$img->thumbnail(150,150,ROOT_PATH . 'article_upimg/'.$uppic);
$img->watermark(ROOT_PATH . 'include/watermark.png', '', '', ROOT_PATH . 'article_upimg/' . $uppic);
} else {
$uppic = $_POST['pic'];
}
$date = date('Y-m-j H:i:s');
if ($_GET['action'] == 'save') {
$db->query("INSERT INTO `article` (`a_sort`,`a_ztid`,`aid`,`title`,`author`,`suggest`,`date`,`pic`,`content`) values ({$a_sort},{$a_ztid},{$aid},'{$title}','{$author}',{$suggest},now(),'{$uppic}','{$content}')");
refer('添加成功', 'article_edit.php');
} else {
$id = $_POST['updateid'];
$db->query("UPDATE `article` SET `p_xilie` = {$p_xilie},`p_sort` = {$p_sort},`p_pinpai` = {$p_pinpai},`name` = '{$name}',`size` = {$size},`xixiang` = '{$xixiang}',`price` = {$price},`p_num` = {$p_num},`suggest` = {$suggest},`pic` = '{$uppic}',`content` = '{$content}' WHERE `id` = {$id}");
refer('更新成功', 'article_manager.php');
示例3: header
if (!$_SESSION['webmaster']) {
header("location:login.php");
}
include '../common.php';
require_once ROOT_PATH . '/include/FileUploader.class.php';
require_once ROOT_PATH . 'include/Image.class.php';
if ($action == 'save' && !empty($title) && !empty($url)) {
$title = m_addslashes($title);
$intro = m_addslashes($content);
$url = trim($url);
$file = $_FILES['uploadpic'];
//文件上传时注意enctype="multipart/form-data"
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['uploadpic']);
$pic = $uf->move(ROOT_PATH . '/video-upimg', 2);
$uppic = $pic[0] ? get_basename($pic[0]) : 'NULL';
$img = new image(ROOT_PATH . 'video-upimg/' . $uppic);
$img->thumbnail(128, 72, ROOT_PATH . 'video-upimg/' . $uppic);
}
$db->query("INSERT INTO `video` VALUES (NULL,'{$title}','{$intro}','{$uppic}','{$url}',now())") or error('Unable to add advertising', __FILE__, __LINE__, $db->error());
refer('添加视频成功');
}
if ($action == 'del' && isset($id)) {
$query_id = $db->query("SELECT img FROM `video` WHERE id = {$id}");
$result = $db->fetch_array($query_id);
$img = $result['img'];
if ($img) {
@unlink(ROOT_PATH . '/video-upimg/' . $img);
}
$db->query("DELETE FROM `video` WHERE id = {$id}") or error('Unable to delete advertising', __FILE__, __LINE__, $db->error());
示例4: header
session_start();
if (!$_SESSION['webmaster']) {
header("location:login.php");
}
require_once '../common.php';
require_once ROOT_PATH . '/include/FileUploader.class.php';
require_once ROOT_PATH . '/include/Image.class.php';
if ($action == 'save' && !empty($name) && !empty($site)) {
$name = m_addslashes($name);
$intro = m_addslashes($intro);
$file = $_FILES['img'];
//文件上传时注意enctype="multipart/form-data"
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['img']);
$pic = $uf->move(ROOT_PATH . 'logos', 2);
$uppic = $pic[0] ? get_basename($pic[0]) : 'NULL';
$img = new image(ROOT_PATH . 'logos/' . $uppic);
$img->thumbnail(88, 31, ROOT_PATH . 'logos/' . $uppic);
//$img->watermark(ROOT_PATH . 'include/watermark.png','','',ROOT_PATH . 'images/'.$uppic);
} elseif ($isimg) {
refer('您未选择图片上传!');
}
$db->query("INSERT INTO `links` VALUES (NULL,'{$name}','{$site}','{$intro}','{$isimg}','{$uppic}','1',now())") or error('Unable to add link', __FILE__, __LINE__);
updateLinkCache();
refer('添加成功');
}
if ($action == 'invisable' && isset($v) && isset($id)) {
$v = $v ? 0 : 1;
$db->query("UPDATE `links` SET invisable = '{$v}' WHERE id = {$id}") or error('Unable to set link\'s invisable', __FILE__, __LINE__, $db->error());
updateLinkCache();