本文整理匯總了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數據表