当前位置: 首页>>代码示例>>PHP>>正文


PHP upload::execute方法代码示例

本文整理汇总了PHP中upload::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::execute方法的具体用法?PHP upload::execute怎么用?PHP upload::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在upload的用法示例。


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

示例1: _uploadYPY

function _uploadYPY($upfile)
{
    global $db, $bidcmskey;
    $up = new upload($upfile);
    $upyun = new UpYun("imgbuket", "tolecen", "11311451167llx");
    $c = "abcdefghigklmnopqrstuvwxyz0123456789";
    $d = substr($c, rand(0, 20), 2) . '/' . substr($c, rand(0, 10), 2);
    $dir = 'data/upload';
    $uploaddir = ROOT_PATH . '/' . $dir;
    $up->max_upload = 10486000;
    $up->insertid = array();
    $up->updir = $uploaddir ? $uploaddir : 'data/upload';
    $img = array();
    $imgtype = array('jpg' => '0', 'gif' => '1', 'png' => '2', 'bmp' => '3');
    if ($up->checkIsFile() && $up->checkStatus() && $up->checkType() && $up->checkSize()) {
        if ($file = $up->execute()) {
            $r = getimagesize($file);
            $filePath = str_replace(ROOT_PATH, "", $uploaddir) . "/";
            $pos = strrpos($file, '/') + 1;
            $fileName = substr($file, $pos);
            $filekey = $bidcmskey . $imgtype[$up->suffpix] . $up->fname[0] . str_replace('/', '', $d);
            $fh = fopen($uploaddir . "/" . $fileName, 'r');
            $upyun->writeFile("/" . $fileName, $fh);
            fclose($fh);
            if (is_file($uploaddir . "/" . $fileName)) {
                @unlink($uploaddir . "/" . $fileName);
            }
            $db->query("insert into " . tname("file") . "(`file_key`, `file_path`, `file_original`, `file_type`, `width`, `height`)values('" . $filekey . "','" . $filePath . "','" . $fileName . "','" . $r['mime'] . "','" . $r['0'] . "','" . $r[1] . "')");
            $up->insertid = array('file_id' => $db->insert_id(), 'key_path' => $filePath, 'key' => $fileName, 'type' => $r['mime'], 'width' => $r[0], 'height' => $r[1]);
        }
    }
    return $up;
}
开发者ID:Tolecen,项目名称:YouthFundWebSite,代码行数:33,代码来源:global.func.php

示例2: upload

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)) {
                increase_integral($dbo, $int_photo, $user_id);
            }
            $photos_array[$i]['id'] = $photo_id;
            $photos_array[$i]['file'] = $thumb_src;
开发者ID:omusico,项目名称:Social,代码行数:31,代码来源:photo_upl.action.php

示例3: _attach

function _attach($upfile, $uploaddir = '', $thumbinfo = array())
{
    $thumb = array();
    if ($_FILES) {
        include ROOT_PATH . '/inc/upload.class.php';
        $count = count($_FILES[$upfile]['name']);
        foreach ($_FILES[$upfile] as $k => $v) {
            for ($i = 0; $i < $count; $i++) {
                $f['tmpupload' . $i][$k] = $v[$i];
            }
        }
        $_FILES = $f;
        foreach ($f as $k => $v) {
            $up = new upload($k);
            $up->updir = $uploaddir ? $uploaddir : $GLOBALS['uploaddir'];
            if ($up->checkFile()) {
                if ($file = $up->execute()) {
                    if ($thumbinfo) {
                        $up->setThumb($file, $file, $thumbinfo['width'], $thumbinfo['height']);
                    }
                    $thumb[] = $file;
                }
            }
        }
    }
    return $thumb;
}
开发者ID:BGCX261,项目名称:zidan-kaka-oneplusone-svn-to-git,代码行数:27,代码来源:global.func.php


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