• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP uploadfile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中uploadfile函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadfile函数的具体用法?PHP uploadfile怎么用?PHP uploadfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了uploadfile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: array

				}
				$target = $INI['system']['imgprefix']."/static/team/{$year}/{$day}/{$fname}";
				if($immediate=='1')$target='!'.$target;
				if($msgtype==1)$msg=$target;
				else $msg=array('url'=>$target,'localname'=>$upfile['name'],'id'=>'1');//id参数固定不变,仅供演示,实际项目中可以是数据库ID
			}
		}
		else $err='上传文件扩展名必需为:'.$upext;

		if (is_resource($upfile['tmp_name'])) {fclose($upfile['tmp_name']);}
		else { @unlink($upfile['tmp_name']); }
	}
	return array('err'=>$err,'msg'=>$msg);
}

//HTML5 上传
if(isset($_SERVER['HTTP_CONTENT_DISPOSITION'])) {
    if(preg_match('/attachment;\s+name="(.+?)";\s+filename="(.+?)"/i',$_SERVER['HTTP_CONTENT_DISPOSITION'],$info)) {
        $temp_name = tmpfile();
		$content = file_get_contents("php://input");
		fwrite($temp_name, $content);
		fseek($temp_name, 0);
        $size = strlen($content);
        $_FILES[$info[1]]=array('name'=>$info[2],'tmp_name'=>$temp_name,'size'=>$size,'type'=> '','error'=>0); 
    }
}
//End HTML5 

$state=uploadfile('filedata');
echo json_encode($state);
开发者ID:noikiy,项目名称:mdwp,代码行数:30,代码来源:upload.php


示例2: _Header

                }
                _Header();
            }
            foreach ($_POST['name'] as $id => $value) {
                $DreamCMS->db->query("update `#DC@__links` set `name`='{$value}',`url`='" . $_POST['url'][$id] . "',`desc`='" . $_POST['description'][$id] . "',`orderid`='" . $_POST['displayorder'][$id] . "' where `id`='{$id}'");
            }
            _Header();
        }
        if ($action == 'add') {
            $id = intval($id);
            $name = $_POST['name'] ? save($_POST['name']) : '';
            $url = $_POST['url'] ? save($_POST['url']) : '';
            $desc = $_POST['description'] ? save($_POST['description']) : '';
            //$logo	= $_POST['logo'];
            $orderid = intval($_POST['displayorder']);
            empty($name) && alert('网站名称不能为空!');
            empty($url) && alert('网站URL不能为空!');
            strpos($url, 'http://') === false && ($url = 'http://' . $url);
            $artlogo = $_POST['artlogo'] ? save($_POST['artlogo']) : '';
            $_logo = uploadfile("logo", $name);
            $logo = empty($_logo) ? $artlogo : $_logo['FilePath'];
            //$DreamCMS->db->query("INSERT INTO `#DC@__links` (`name`,`logo`,`desc`,`url`,`orderid`) VALUES ('$name','$logo','$desc','$url','$orderid')");
            if ($id) {
                $DreamCMS->db->query("UPDATE `#DC@__links` SET `name`='{$name}',`logo`='{$logo}',`desc`='{$desc}',`url`='{$url}',`orderid`='{$orderid}' WHERE `id`='{$id}' LIMIT 1");
            } else {
                $DreamCMS->db->query("INSERT INTO `#DC@__links` (`name`,`logo`,`desc`,`url`,`orderid`) VALUES ('{$name}','{$logo}','{$desc}','{$url}','{$orderid}')");
            }
            _Header("admincp.php?do=link");
        }
        break;
}
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:link.inc.php


示例3: register

     register();
 } else {
     if ($ask == "edituser") {
         edituser();
     } else {
         if ($ask == "changepsd") {
             changepsd();
         } else {
             if ($ask == "delete") {
                 del();
             } else {
                 if ($ask == "image") {
                     uploadimage();
                 } else {
                     if ($ask == "file") {
                         uploadfile();
                     } else {
                         if ($ask == "lzl") {
                             lzl();
                         } else {
                             if ($ask == "search") {
                                 search();
                             } else {
                                 if ($ask == "action") {
                                     action();
                                 } else {
                                     echo '<capu><info><code>14</code><msg>ask错误。</msg></info></capu>';
                                     exit;
                                 }
                             }
                         }
开发者ID:hun-tun,项目名称:CAPUBBS,代码行数:31,代码来源:client.php


示例4: pkpost


//.........这里部分代码省略.........
            }
        }
    } elseif ($_G['myshopstatus'] == 'unverified') {
        $setsqlarr['grade'] = 0;
    }
    $setsqlarr['dateline'] = $_G['timestamp'];
    $setsqlarr['uid'] = $_G['uid'];
    $setsqlarr['username'] = $_G['username'];
    $setsqlarr['lastpost'] = $setsqlarr['dateline'];
    // 標題圖片處理 Start
    if (!empty($modelsinfoarr['thumbsize'])) {
        $modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize']));
        $modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0];
        $modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1];
    }
    if ($_POST['imagetype'] == 0 && $modelsinfoarr['modelname'] == 'consume' && $_G['setting']['allowcreateimg']) {
        if ($_GET['action'] == 'add') {
            $hotline = $_SGLOBAL['panelinfo']['tel'];
            $address = $_SGLOBAL['panelinfo']['address'];
        } else {
            $shopinfo = DB::fetch(DB::query("SELECT tel, address FROM " . tname('shopitems') . " WHERE itemid='{$setsqlarr['shopid']}'"));
            $hotline = $shopinfo['tel'];
            $address = $shopinfo['address'];
        }
        $dealer_name = DB::result_first("SELECT subject FROM " . tname('shopitems') . " WHERE itemid='{$setsqlarr['shopid']}'");
        $createimgarr = array('id' => intval($_POST['imgtplid']), 'mid' => intval($modelsinfoarr['mid']), 'itemid' => intval($itemid), 'coupon_title' => $setsqlarr['subject'], 'dealer_id' => $setsqlarr['uid'], 'dealer_name' => $dealer_name, 'begin_date' => date('Y-m-d', $setsqlarr['validity_start']), 'end_date' => date('Y-m-d', $setsqlarr['validity_end']), 'brief' => trim($_POST['message']), 'exception' => trim($_POST['exception']), 'address' => $address, 'hotline' => $hotline, 'subjectimagewidth' => $modelsinfoarr['subjectimagewidth'], 'subjectimageheight' => $modelsinfoarr['subjectimageheight']);
        require_once B_ROOT . './source/adminfunc/tool.func.php';
        if ($consumeimgpath = image_text($createimgarr)) {
            $setsqlarr['subjectimage'] = $consumeimgpath;
            $setsqlarr['imagetype'] = 0;
            $setsqlarr['imgtplid'] = intval($_POST['imgtplid']);
        }
    } else {
        $uploadfilearr = $ids = array();
        $subjectimageid = '';
        $uploadfilearr = uploadfile(array(array('fieldname' => 'subjectimage', 'fieldcomment' => '圖片標題', 'formtype' => 'img')), $modelsinfoarr['mid'], 0, 1, $modelsinfoarr['subjectimagewidth'], $modelsinfoarr['subjectimageheight']);
        if (!empty($uploadfilearr)) {
            $feedsubjectimg = $uploadfilearr;
            foreach ($uploadfilearr as $tmpkey => $tmpvalue) {
                if (empty($tmpvalue['error'])) {
                    $setsqlarr[$tmpkey] = $tmpvalue['filepath'];
                }
                if (!empty($tmpvalue['aid'])) {
                    $ids[] = $tmpvalue['aid'];
                }
            }
        }
        if ($modelsinfoarr['modelname'] == 'consume') {
            $setsqlarr['imagetype'] = 1;
        }
    }
    /* --------- 標題圖片處理 End --------------*/
    //詞語過濾
    if (!empty($modelsinfoarr['allowfilter'])) {
        $setsqlarr = scensor($setsqlarr, 1);
    }
    //發佈時間
    $setsqlarr['dateline'] = $_G['timestamp'];
    // 商品添加簡介
    if ($mname == "good") {
        $setsqlarr['intro'] = trim(strip_tags($_POST['intro']));
    }
    if (empty($itemid)) {
        //插入數據
        $itemid = inserttable($modelsinfoarr['modelname'] . 'items', $setsqlarr, 1);
        if (in_array($modelsinfoarr['modelname'], array('good', 'notice', 'consume', 'album', 'groupbuy'))) {
开发者ID:pan289091315,项目名称:Discuz,代码行数:67,代码来源:brandpost.func.php


示例5: modelpost

/**
 * 模型在线投稿提交处理函数
 */
function modelpost($cacheinfo, $cp = 1)
{
    global $_SGLOBAL, $theurl, $_SCONFIG;
    include_once S_ROOT . './function/upload.func.php';
    $_POST['mid'] = !empty($_POST['mid']) ? intval($_POST['mid']) : 0;
    $itemid = !empty($_POST['itemid']) ? intval($_POST['itemid']) : 0;
    $hash = '';
    $op = 'add';
    $resultitems = $resultmessage = array();
    $modelsinfoarr = $cacheinfo['models'];
    $columnsinfoarr = $cacheinfo['columns'];
    if (empty($_POST['mid']) || $_POST['mid'] != $modelsinfoarr['mid']) {
        showmessage('parameter_error');
    }
    $feedcolum = array();
    foreach ($columnsinfoarr as $result) {
        if ($result['isfixed'] == 1) {
            $resultitems[] = $result;
        } else {
            $resultmessage[] = $result;
        }
        if ($result['formtype'] == 'linkage') {
            if (!empty($_POST[$result['fieldname']])) {
                $_POST[$result['fieldname']] = $cacheinfo['linkage']['info'][$result['fieldname']][$_POST[$result['fieldname']]];
            }
        } elseif ($result['formtype'] == 'timestamp') {
            if (empty($_POST[$result['fieldname']])) {
                $_POST[$result['fieldname']] = $_SGLOBAL['timestamp'];
            } else {
                $_POST[$result['fieldname']] = sstrtotime($_POST[$result['fieldname']]);
            }
        }
    }
    //更新用户最新更新时间
    if (empty($itemid) && $_SGLOBAL['supe_uid']) {
        updatetable('members', array('updatetime' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid']));
    }
    //输入检查
    $_POST['catid'] = intval($_POST['catid']);
    $_POST['allowreply'] = isset($_POST['allowreply']) ? intval($_POST['allowreply']) : checkperm('allowcomment') ? 1 : 0;
    $_POST['subject'] = shtmlspecialchars(trim($_POST['subject']));
    //检查输入
    if (strlen($_POST['subject']) < 2 || strlen($_POST['subject']) > 80) {
        showmessage('space_suject_length_error');
    }
    if (empty($_POST['catid'])) {
        showmessage('admin_func_catid_error');
    }
    if (!empty($_FILES['subjectimage']['name'])) {
        $fileext = fileext($_FILES['subjectimage']['name']);
        if (!in_array($fileext, array('jpg', 'jpeg', 'gif', 'png'))) {
            showmessage('document_types_can_only_upload_pictures');
        }
    }
    //数据检查
    checkvalues(array_merge($resultitems, $resultmessage), 0, 1);
    //修改时检验标题图片是否修改
    $defaultmessage = array();
    if (!empty($itemid)) {
        if (empty($_POST['subjectimage_value']) || !empty($_FILES['subjectimage']['name'])) {
            //当file删除时,或修改时执行删除操作
            $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'items') . ' WHERE itemid = \'' . $itemid . '\'');
            $defaultmessage = $_SGLOBAL['db']->fetch_array($query);
            $hash = getmodelhash($_GET['mid'], $itemid);
            deletetable('attachments', array('hash' => $hash, 'subject' => 'subjectimage'));
            //删除附件表
            updatetable($modelsinfoarr['modelname'] . 'items', array('subjectimage' => ''), array('itemid' => $itemid));
            $ext = fileext($defaultmessage['subjectimage']);
            if (in_array($ext, array('jpg', 'jpeg', 'png'))) {
                @unlink(A_DIR . '/' . substr($defaultmessage['subjectimage'], 0, strrpos($defaultmessage['subjectimage'], '.')) . '.thumb.jpg');
            }
            @unlink(A_DIR . '/' . $defaultmessage['subjectimage']);
        }
    }
    //构建数据
    $setsqlarr = $setitemsqlarr = array();
    $setsqlarr = getsetsqlarr($resultitems);
    $setsqlarr['catid'] = $_POST['catid'];
    $setsqlarr['subject'] = $_POST['subject'];
    $setsqlarr['allowreply'] = $_POST['allowreply'];
    if (checkperm('managefolder') || checkperm('managemodpost')) {
        $setsqlarr['grade'] = intval($_POST['grade']);
    } else {
        $setsqlarr['grade'] = 0;
    }
    $setsqlarr['dateline'] = $_SGLOBAL['timestamp'];
    $setsqlarr['uid'] = $_SGLOBAL['supe_uid'];
    $setsqlarr['username'] = $_SGLOBAL['supe_username'];
    $setsqlarr['lastpost'] = $setsqlarr['dateline'];
    $modelsinfoarr['subjectimagewidth'] = 400;
    $modelsinfoarr['subjectimageheight'] = 300;
    if (!empty($modelsinfoarr['thumbsize'])) {
        $modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize']));
        $modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0];
        $modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1];
    }
    $uploadfilearr = $ids = array();
//.........这里部分代码省略.........
开发者ID:jonycookie,项目名称:projectm2,代码行数:101,代码来源:model.func.php


示例6: optional_param

// file or dir hash
$requestid = optional_param('requestid', "", PARAM_TEXT);
// file or dir hash
$paramone = optional_param('paramone', "", PARAM_TEXT);
// nature of value depends on datatype, maybe path
$paramtwo = optional_param('paramtwo', "", PARAM_TEXT);
// nature of value depends on datatype, maybe protocol
$paramthree = optional_param('paramthree', "", PARAM_TEXT);
// nature of value depends on datatype, maybe filearea
switch ($datatype) {
    case "uploadfile":
        header("Content-type: text/xml");
        echo "<?xml version=\"1.0\"?>\n";
        //uploadfile filedata(base64), fileextension (needs to be cleaned), blah blah
        //paramone is the file data, paramtwo is the file extension, requestid is the actionid
        $returnxml = uploadfile($paramone, $paramtwo, $requestid, $contextid, $comp, $farea, $itemid);
        break;
    case "poodllpluginfile":
        //poodllpluginfile($contextid,$component,$filearea,$itemid,$filepath,$filename);
        //lets hard code this for now, very very mild security
        poodllpluginfile($contextid, "mod_assignment", "submission", $itemid, "/", $paramone);
        return;
    case "getlast20files":
        header("Content-type: text/html");
        $returnxml = "";
        echo "hi";
        getLast20Files();
        break;
    case "getrepodata":
        header("Content-type: text/xml");
        echo "<?xml version=\"1.0\"?>\n";
开发者ID:laiello,项目名称:poodll.poodll2,代码行数:31,代码来源:poodllfilelib.php


示例7: intval

 $positions = intval($_POST['positions']);
 //赛制图标 start
 $articonpic = save($_POST['articonpic']);
 $_iconpic = uploadfile("iconpic", $sortname);
 $iconpic = empty($_iconpic) ? $articonpic : $_iconpic['FilePath'];
 //赛制图标 end
 $teamname1 = save($_POST['teamname1']);
 //队列1图标 start
 $artteampic1 = save($_POST['artteampic1']);
 $_teampic1 = uploadfile("teampic1", $sortname);
 $teampic1 = empty($_teampic1) ? $artteampic1 : $_teampic1['FilePath'];
 //队列1图标 end
 $teamname2 = save($_POST['teamname2']);
 //队列2图标 start
 $artteampic2 = save($_POST['artteampic2']);
 $_teampic2 = uploadfile("teampic2", $sortname);
 $teampic2 = empty($_teampic2) ? $artteampic2 : $_teampic2['FilePath'];
 //队列2图标 end
 $starttime = $_POST['starttime'] ? _strtotime($_POST['starttime']) : 0;
 $endtime = $_POST['endtime'] ? _strtotime($_POST['endtime']) : 0;
 $addtime = time();
 $showstate = intval($_POST['showstate']);
 //播放来源 start
 $playsource = '';
 if ($_POST['play_url'] && is_array($_POST['play_url'])) {
     foreach ($_POST['play_url'] as $key => $val) {
         $thisplay_url = save($val);
         if ($thisplay_url) {
             //排序 start
             $numkey = addKey($playsource, $_POST['play_orders'][$key]);
             //排序 end
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:events_liverecomment.inc.php


示例8: king_def

function king_def()
{
    $state = uploadfile('filedata');
    echo json_encode($state);
}
开发者ID:jonycookie,项目名称:projectm2,代码行数:5,代码来源:upload.php


示例9: fopen

$font = @$_POST['font'];
$userban = @$_POST['userban'];
$size = @$_POST['size'];
$theme = @$_POST['explorer-theme'];
$ban = @$_FILES['ban'];
$userfile = fopen(USER_CONF_FILE, 'x');
if ($userfile == FALSE) {
    header("Status: 301 Moved Permanently", false, 301);
    header("Location: http://{$host}");
    exit;
} else {
    fwrite($userfile, $id_code . "\r\n");
    fwrite($userfile, $background . "\r\n");
    fwrite($userfile, $font . "\r\n");
    fwrite($userfile, $userban . "\r\n");
    fwrite($userfile, $size . "\r\n");
    fwrite($userfile, $theme);
    fclose($userfile);
    if ($userban == 'no') {
        header("Status: 301 Moved Permanently", false, 301);
        header("Location: http://{$host}/");
        exit;
    } else {
        include 'inc/config/upload.php';
        $userdir = 'css/img/user.jpg';
        uploadfile($ban, $userdir);
    }
    header("Status: 301 Moved Permanently", false, 301);
    header("Location: http://{$host}/");
    exit;
}
开发者ID:Cosmikats,项目名称:nova-content,代码行数:31,代码来源:custom.php


示例10: exit

 * @author coolmoo <[email protected]>
 */
!defined('iPATH') && exit('What are you doing?');
switch ($action) {
    case 'editor':
        $F = uploadfile("upload");
        echo json_encode(array('err' => '', 'msg' => uploadfile("upload")["FilePath"]));
        break;
    case 'Aupload':
        strpos($_POST['savedir'], '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
        $F = uploadfile("file");
        alert($F["OriginalFileName"] . '上传成功!', 'javascript:insert("' . $F["FilePath"] . '","' . $_POST['in'] . '");');
        break;
    case 'uploadfile':
        strpos($_POST['savedir'], '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
        $F = uploadfile("file", '', $_POST['savedir']);
        alert($F["OriginalFileName"] . '上传成功!', 'javascript:window.parent.location.reload();');
        break;
    case 'createdir':
        $dirname = $_POST['dirname'];
        $savedir = $_POST['savedir'];
        strpos($savedir, '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
        strpos($dirname, '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
        createdir(iPATH . $iCMS->config['uploadfiledir'] . "/" . $savedir . $dirname);
        alert("目录[{$dirname}]创建成功!", 'javascript:window.parent.location.reload();');
        break;
    case 'crop':
        //header('Content-type: image/jpeg');
        $tMap = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
        $pic = $_POST['pFile'];
        $iPic = getfilepath($pic, iPATH, '+');
开发者ID:jonycookie,项目名称:projectm2,代码行数:31,代码来源:dialog.post.php


示例11: upload

function upload($usuario, $empresa, $conexion)
{
    if (get('VUP')) {
        //VUP : Valida Upload
        $filedata = (string) $_GET['filedata'];
        $filedata = unserialize(base64_decode($filedata));
        $return = array('filedata' => $filedata);
        return $return;
    }
    $path = (string) post("path");
    $filedata = (string) post("filedata");
    $formId = (string) post("formId");
    $campo = (string) post("campo");
    $return = array('success' => false, 'msg' => 'No se pudo subir el archivo.');
    if ($_FILES['error'] == UPLOAD_ERR_OK) {
        $filedata = unserialize(base64_decode($filedata));
        $filesize = $_FILES["file"]["size"];
        $maxfile = $filedata["maxfile"] * 1024 * 1024;
        if ($filesize <= $maxfile) {
            $codigo = (int) numerador('archivoTemporal', 0, '');
            $return = uploadfile($codigo, $_FILES, $path, $filedata["tipos"]);
            if ($return['success']) {
                //deleteFileTemporal($formId, $conexion);
                insertFileTemporal($codigo, $return, $formId, $campo, $usuario, $empresa, $conexion);
            }
        } else {
            $return['msg'] = "El archivo no puede superar los {$filedata["maxfile"]} Mb";
        }
    }
    // return "daniel";
    return $return;
}
开发者ID:dice9030,项目名称:GestionLogistico,代码行数:32,代码来源:funciones.php


示例12: msgexiterror

        msgexiterror("notright", "", "disable");
        exit;
    }
}
if (isset($_FILES["userfile"])) {
    if ($codekey == 7) {
        demo();
    }
    if (!$path) {
        echo "Path потерян... конец операции...";
        exit;
    } else {
        if ($pr[68]) {
            $redirecttoshare = 1;
        }
        $err = uploadfile($path, "original");
    }
    if ($err == false) {
        echo "upload fail.";
    }
    if ($err == true) {
        echo "upload complete.";
    }
    exit;
}
//echo "OSTYPE==$OSTYPE";
if ($pr[41]) {
    $defaultpath = $pr[41];
} else {
    if ($OSTYPE == "LINUX") {
        $defaultpath = getcwd() . "/";
开发者ID:serj-43,项目名称:db-script,代码行数:31,代码来源:filemgr.php


示例13: lprint

}
if ($publicdemo) {
    $serial = "publicdemo";
}
if ($test) {
    $serial = $testenable;
}
if (isset($_FILES["userfile"])) {
    //проверяем посланный ключ //йух посылается , а не ключ... мдя интересно с какой это
    //	if ($go=="Send key") { //проверяем посланный ключ
    $uploaddir = "_conf";
    if ($size > 700) {
        echo "Превышен hardcoded лимит в 300bytes";
        exit;
    }
    if (uploadfile($uploaddir, "add.key")) {
        lprint("FS_FWR");
    } else {
        lprint("FS_FWRFAIL");
    }
    //echo "2userfile=$userfile  go=$go path=$path (disabled) ";
    Header("Location: login.php");
    //пофиксили баг с лишним обновлением.  не пересылаем заново временно пока херня не пройдет
}
if ($prauth[$ADM][2] == false and $prauth[$ADM][11]) {
    lprint("A_LOG_BAN");
    ?>
<form action="login.php" method="post"> <?php 
    submitkey("resetcookie", "LOGOUT");
    echo "</form>";
    exit;
开发者ID:serj-43,项目名称:db-script,代码行数:31,代码来源:login.php


示例14: news

 if ($_POST["selectoption"] == "Новости") {
     news($mysqli, $tmpl['newsAdmin']);
 } else {
     if (isset($_POST["selectedNews"])) {
         if ($_POST["selectnews"] == "Новый вопрос") {
             addnews($mysqli, $tmpl["addnews"]);
         } else {
             insertOrDeleteNews($mysqli, $tmpl["updatenews"], $_POST["selectnews"], $tmpl["updatecoments"]);
         }
     } else {
         if (isset($_POST["addnew"])) {
             $title = $_POST["title1"];
             $category = $_POST["categorynews"];
             $text = $_POST["text"];
             $isHot = $_POST["isHot"];
             uploadfile($mysqli);
             addnewsDB($mysqli, $title, $category, $text, $isHot);
             $_SESSION["list"] = $tmpl['mainAdmin'];
         } else {
             if (isset($_POST["insertnew"])) {
                 //получим id категории
                 $sth = $mysqli->prepare("SELECT id2 FROM Category2 WHERE categ2 = ?  ");
                 $sth->bind_Param("s", $_POST["categorynews"]);
                 $sth->execute();
                 $result = $sth->get_result();
                 $obj = $result->fetch_assoc();
                 $idcat = $obj["id2"];
                 $result->close();
                 $hot = 0;
                 if ($_POST["isHot"] == "on") {
                     $hot = 1;
开发者ID:Maksumys,项目名称:lab8,代码行数:31,代码来源:event.php


示例15: alert

     } else {
         alert('您没有任何数据编辑');
     }
 }
 if ($action == 'add') {
     $id = (int) $_POST['id'];
     $name = save($_POST['name']);
     $orders = intval($_POST['orders']);
     $types = intval($_POST['types']);
     !$types && alert('类型错误!');
     !$name && alert('名称不能为空!');
     if ($delpics) {
         $pics = '';
     } else {
         $artpics = save($_POST['artpics']);
         $_pics = uploadfile("pics", $name);
         $pics = empty($_pics) ? $artpics : $_pics['FilePath'];
     }
     $returnurl = $_POST['returnurl'] ? rawurldecode($_POST['returnurl']) : 'admincp.php?do=events_playsource&operation=manage&types=' . $types;
     $set = " `orders`='{$orders}',`name`='{$name}',`pics`='{$pics}' ";
     if ($id) {
         $up = $DreamCMS->db->query("UPDATE `#DC@__events_playsource` SET " . $set . " WHERE `types`='{$types}' AND `id`='{$id}' LIMIT 1 ");
         if ($up !== false) {
             redirect("编辑完成!", $returnurl, '2');
         } else {
             alert('编辑失败');
         }
     } else {
         $set .= ",`types`='{$types}' ";
         $add = $DreamCMS->db->query("INSERT INTO `#DC@__events_playsource` SET " . $set);
         if ($add) {
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:events_playsource.inc.php


示例16: alert

         alert('操作成功!', 'url:1');
     }
 } else {
     //添加
     $add = $DreamCMS->db->query("INSERT INTO `#DC@__installhelper` " . $sql);
     if ($add) {
         $itid = mysql_insert_id();
         $field = 'picshows';
         //添加文章图片集 start
         if ($_FILES[$field]['name'] && is_array($_FILES[$field]['name'])) {
             foreach ($_FILES[$field]['name'] as $key => $val) {
                 $_FILES[$field . $key]['name'] = $val;
                 $_FILES[$field . $key]['tmp_name'] = $_FILES[$field]['tmp_name'][$key];
                 $_FILES[$field . $key]['error'] = $_FILES[$field]['error'][$key];
                 $_FILES[$field . $key]['size'] = $_FILES[$field]['size'][$key];
                 $tupianji = uploadfile($field . $key, $title . "--图片" . $key + 1);
                 $articlepic = $tupianji['FilePath'];
                 //图片描述 start
                 $picsdes = $field . "picdes";
                 $picdes = save($_POST[$picsdes][$key]);
                 //图片描述 end
                 //图片排序 start
                 $picsorder = $field . "picorder";
                 $picorder = intval($_POST[$picsorder][$key]);
                 //图片排序 end
                 $DreamCMS->db->query("INSERT INTO `#DC@__installhelper_pics` SET `itid`='{$itid}',`articlepic`='{$articlepic}',`picdes`='{$picdes}',`picorder`='{$picorder}',`picfield`='{$field}'");
                 $tupianji = '';
             }
         }
         //添加文章图片集 end
         alert('操作成功!', 'url:1');
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:installhelper.inc.php


示例17: foreach

                 $tupianji = '';
             }
         }
         //------添加文章图片集 end
         //------更新文章图片集 start
         $picedit = $field . "_edit";
         $artpicedit = "art_" . $field . "_edit";
         $picids = $field . "picids";
         if ($_FILES[$picedit]['name'] && is_array($_FILES[$picedit]['name'])) {
             foreach ($_FILES[$picedit]['name'] as $key => $val) {
                 $_FILES[$picedit . $key]['name'] = $val;
                 $_FILES[$picedit . $key]['tmp_name'] = $_FILES[$picedit]['tmp_name'][$key];
                 $_FILES[$picedit . $key]['error'] = $_FILES[$picedit]['error'][$key];
                 $_FILES[$picedit . $key]['size'] = $_FILES[$picedit]['size'][$key];
                 $picid = intval($_POST[$picids][$key]);
                 $tupianji = uploadfile($picedit . $key, $title . "商品图片-商品" . $picid);
                 $articlepic = empty($tupianji) ? save($_POST[$artpicedit][$key]) : $tupianji['FilePath'];
                 //------图片描述 start
                 $picsdes = $field . "picdes_edit";
                 $picdes = save($_POST[$picsdes][$key]);
                 //------图片描述 end
                 //------图片排序 start
                 $picsorder = $field . "picorder_edit";
                 $picorder = intval($_POST[$picsorder][$key]);
                 //------图片排序 end
                 $picid && $DreamCMS->db->query("UPDATE `#DC@__article_pics` SET `aid`='{$aid}',`articlepic`='{$articlepic}',`picdes`='{$picdes}',`picorder`='{$picorder}' WHERE `picid`='{$picid}' LIMIT 1");
             }
         }
         //------更新文章图片集 end
     }
 }
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:article.inc.php


示例18: md5

} else {
    SmartyValidate::connect($smarty);
    // validate after a POST
    if (SmartyValidate::is_valid($_POST)) {
        // no errors, done with SmartyValidate
        if (array_key_exists('submit', $_POST)) {
            //var_dump($_POST); exit;
            $firstname = $_POST['firstname'];
            $lastname = $_POST['lastname'];
            $mobile_number = $_POST['mobile_number'];
            $email = $_POST['email'];
            $password = md5($_POST['password']);
            $location = $_POST['area_element'];
            $medical = $_POST['medical'];
            $profile = $_POST['profile'];
            $pix = uploadfile('pix');
            //exit();
            $userID = $obj->newUser($lastname, $firstname, $email, $mobile_number, $password, $location, $pix, $profile);
            if (empty($medical)) {
            } else {
                if ($medical == 'specialist') {
                    $specializationID = $_POST['specialist'];
                    $hospital = $_POST['hospitals'];
                    $obj->addNewSpecialist($userID, $specializationID, $hospital);
                } else {
                    if ($medical == 'pharmacist') {
                        $pharmacy = $_POST['pharmacy'];
                        $certifiedNumber = $_POST['certify'];
                        $obj->addPharmacist($pharmacy, $userID, $location, $certifiedNumber);
                    } else {
                        if ($medical == 'hospital') {
开发者ID:hiroyalty,项目名称:mhealth,代码行数:31,代码来源:register.php


示例19: alert

            alert('删除成功', 'url:1');
        } else {
            alert('删除失败');
        }
        exit;
        break;
    case 'post':
        if ($action == 'edit') {
            foreach ($_POST['picdes'] as $picid => $value) {
                $thispicorder = intval($_POST['picorder'][$picid]);
                $picid && $DreamCMS->db->query("update `#DC@__otherpics` set `picdes`='{$value}',`picorder`='{$thispicorder}' where `picid`='{$picid}'");
            }
            _Header();
        }
        if ($action == 'add') {
            $picid = intval($picid);
            $picdes = $_POST['picdes'] ? save($_POST['picdes']) : '';
            $picorder = intval($_POST['picorder']);
            $pictype = $_POST['pictype'] ? save($_POST['pictype']) : 'download';
            $artpicurl = $_POST['artpicurl'] ? save($_POST['artpicurl']) : '';
            $_picurl = uploadfile("picurl", $picdes);
            $picurl = empty($_picurl) ? $artpicurl : $_picurl['FilePath'];
            if ($picid) {
                $DreamCMS->db->query("UPDATE `#DC@__otherpics` SET `picdes`='{$picdes}',`picorder`='{$picorder}',`pictype`='{$pictype}',`picurl`='{$picurl}' WHERE `picid`='{$picid}' LIMIT 1");
            } else {
                $DreamCMS->db->query("INSERT INTO `#DC@__otherpics` (`picdes`,`picorder`,`pictype`,`picurl`) VALUES ('{$picdes}','{$picorder}','{$pictype}','{$picurl}')");
            }
            _Header("admincp.php?do=otherpics&pictype=" . $pictype);
        }
        break;
}
开发者ID:20000Hz,项目名称:bak-letvs,代码行数:31,代码来源:otherpics.inc.php


示例20: unlink

     if ($file == 1) {
         //файл есть , предпринимаем меры
         if (!$tempsize) {
             echo "Это не картинка ! Файл не был сохранен. <br>";
             exit;
         }
         // тоже 0 при >64k
         if ($size > 900000) {
             echo "Превышен hardcoded лимит в 900Кб";
             exit;
         }
         //CFG OPT FUTURE  TODO:
         echo "Куда:" . $uploaddir . "/ File:" . $commmsg . $formatscr . "<br>";
         echo "fullpathname={$scrfullpathname}<br>";
         unlink($scrfullpathname);
         $error = uploadfile($uploaddir . "/", $commmsg . $formatscr);
         //почему !!!?? Залить не удалось
         die("Aaaaaaaaaaa");
         if ($error) {
             ob_clean();
             lprint("FS_FWR");
         } else {
             ob_clean();
             lprint("FS_FWRFAIL");
         }
         echo $uploaddir . "/", $commmsg . ".jpg";
         echo "Он был успешным юзернеймом на УПячке!<br>";
     }
 }
 //end of upload//....        if($error==false) echo "Слив не засчитан";	//end comment write
 if ($delcom) {
开发者ID:serj-43,项目名称:db-script,代码行数:31,代码来源:w.php



注:本文中的uploadfile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP uploadprogress_get_info函数代码示例发布时间:2022-05-23
下一篇:
PHP upload_rename函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap