本文整理汇总了PHP中upload::set_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::set_dir方法的具体用法?PHP upload::set_dir怎么用?PHP upload::set_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::set_dir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
action_return(0, $a_langpackage->a_upload_maximum . $limcount . $a_langpackage->a_attachments, "-1");
}
//检测上传相片是否都为空
$is_true = 0;
for ($i = 0; $i < count($_FILES['attach']['name']); $i++) {
if (!empty($_FILES['attach']['name'][$i])) {
$is_true++;
}
}
if ($is_true == 0) {
action_return(0, $a_langpackage->a_no_pht, "-1");
}
$base_root = "uploadfiles/album/";
//图片存放目录
$up = new upload();
$up->set_dir($base_root, '{y}/{m}/{d}');
//目录设置
$up->set_thumb(180, 180);
//缩略图设置
$fs = $up->execute();
$i = 0;
foreach ($fs as $index => $realtxt) {
if ($realtxt['flag'] == 1) {
$fileSrcStr = str_replace(dirname(__FILE__), "", $realtxt['dir']) . $realtxt['name'];
$thumb_src = str_replace(dirname(__FILE__), "", $realtxt['dir']) . $realtxt['thumb'];
$sql = "insert into {$t_photo}(`user_id`,`add_time`,`photo_src`,`photo_thumb_src`,`album_id`,`user_name`,`privacy`)\r\n\t\t\t\t\t values({$user_id},now(),'{$fileSrcStr}','{$thumb_src}',{$album_id},'{$user_name}','');";
if ($dbo->exeUpdate($sql)) {
$photo_id = mysql_insert_id();
$fs[$index]['photo_id'] = $photo_id;
$sql = "update {$t_album} set photo_num=photo_num+1,update_time=NOW() where album_id={$album_id}";
if ($dbo->exeUpdate($sql)) {
示例2: pubtooslp
<?php
//语言包引入
$pu_langpackage = new pubtooslp();
$limcount = 1;
//限制每次上传附件数量
if (count($_FILES['attach']['name']) > $limcount) {
action_return(0, $pu_langpackage->pu_count_err, '-1');
}
dbtarget('w', $dbServs);
$dbo = new dbex();
$up = new upload();
$up->set_dir($webRoot . 'uploadfiles/photo_store/', '{y}/{m}/{d}');
$fs = $up->execute();
$user_id = get_sess_userid();
//用户ID
//定义文件表
$t_uploadfile = $tablePreStr . "uploadfile";
$realtxt = $fs[0];
if ($realtxt['flag'] == 1) {
$fileSrcStr = str_replace($webRoot, "", $realtxt['dir']) . $realtxt['name'];
$fileName = $realtxt['initname'];
$sql = "insert into {$t_uploadfile} (file_name,file_src,user_id,add_time) values ('{$fileName}','{$fileSrcStr}','{$user_id}',NOW())";
$dbo->exeUpdate($sql);
$last_id = mysql_insert_id();
echo "<script type='text/javascript'>parent.AddContentImg('{$fileSrcStr}','{$last_id}');</script>";
action_return(1, "", 'modules.php?app=upload_form');
} else {
if ($realtxt[flag] == -1) {
action_return(0, $pu_langpackage->pu_type_err, '-1');
} else {
示例3: intval
if ($role == 2) {
action_return(0, $g_langpackage->g_no_privilege, "-1");
}
//定义写操作
dbtarget('w', $dbServs);
$group_name = short_check(get_argp('group_name'));
$group_resume = short_check(get_argp('group_resume'));
$group_join_type = intval(get_argp('group_join_type'));
$group_type_id = intval(get_argp('group_type_id'));
$group_type_name = short_check(get_argp('group_type_name'));
$tag = short_check(get_argp('tag'));
$gonggao = short_check(get_argp('affiche'));
$is_pic = "";
if (isset($_FILES['attach']) && $_FILES['attach']['name'][0] != '') {
$up = new upload();
$up->set_dir('uploadfiles/group_logo/', '{y}/{m}/{d}');
//目录设置
$fs = $up->execute();
if ($fs[0]['flag'] == -1) {
action_return(0, $g_langpackage->g_logo_limit, "-1");
}
$fileSrcStr = str_replace(dirname(__FILE__), "", $fs[0]['dir']) . $fs[0]['name'];
@unlink(get_argp('old_group_logo'));
$is_pic = ",group_logo='{$fileSrcStr}'";
}
$sql = "update {$t_groups} set group_name='{$group_name}',affiche ='{$gonggao}',tag = '{$tag}',group_resume = '{$group_resume}',group_join_type = {$group_join_type},group_type = '{$group_type_name}',group_type_id={$group_type_id} {$is_pic} where group_id={$group_id}";
$dbo->exeUpdate($sql);
$jump = "modules.php?app=group_manager&group_id={$group_id}";
action_return(1, '', $jump);
?>
示例4: upload
$tag = short_check(get_argp('tag'));
//判断用户已经建立的群组数量
if (count(explode(",", $sess_creat_group)) >= 5) {
action_return(0, $g_langpackage->g_c_limit, "-1");
}
//数据表定义区
$t_groups = $tablePreStr . "groups";
$t_users = $tablePreStr . "users";
$t_group_members = $tablePreStr . "group_members";
//判定是否有图片
$fileSrcStr = 'uploadfiles/group_logo/default_group_logo.jpg';
$thumb_src = '';
if ($_FILES['attach']['name'][0] != '') {
$base_dir = "uploadfiles/group_logo/";
$up = new upload();
$up->set_dir($base_dir, '{y}/{m}/{d}');
//目录设置
$up->set_thumb(150, 150);
//缩略图设置
$fs = $up->execute();
if ($fs[0]['flag'] == -1) {
action_return(0, $g_langpackage->g_logo_limit, "-1");
}
$fileSrcStr = str_replace(dirname(__FILE__), "", $fs[0]['dir']) . $fs[0]['name'];
unlink($fileSrcStr);
$thumb_src = str_replace(dirname(__FILE__), "", $fs[0]['dir']) . $fs[0]['thumb'];
}
//定义写操作
dbtarget('w', $dbServs);
$dbo = new dbex();
//插入group数据表