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


PHP uploader::rename_file方法代码示例

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


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

示例1: errorLogin

        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    } elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
            $my_uploader->save_file('uploads/pics/', '2');
        }
        if ($my_uploader->return_error()) {
            error($my_uploader->return_error(), 'editprofile.php?action=pic');
        } else {
            if (file_exists($my->pic)) {
                @unlink($my->pic);
            }
            $ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
        }
        $my->pic = 'uploads/pics/' . $my->id . $ext;
    } elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
        $my->pic = checkRemotePic($pic, $url_ary, $my->id);
    } else {
        removeOldImages('uploads/pics/', $my->id);
    }
    $db->query("UPDATE {$db->pre}user SET pic = '{$my->pic}' WHERE id = '{$my->id}' LIMIT 1", __LINE__, __FILE__);
    ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic") {
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    $breadcrumb->Add($lang->phrase('editprofile_pic'));
    echo $tpl->parse("header");
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:editprofile.php

示例2: eval

    ($code = $plugins->load('editprofile_pic3_end')) ? eval($code) : null;
    ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic2") {
    $pic = $gpc->get('pic', none);
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    $error = array();
    if (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        $my_uploader->file_types(explode(',', $config['avfiletypes']));
        $my_uploader->set_path('uploads/pics/');
        $my_uploader->rename_file($my->id);
        if ($my_uploader->upload('upload')) {
            removeOldImages('uploads/pics/', $my->id);
            if ($my_uploader->save_file()) {
                $my->pic = 'uploads/pics/' . $my_uploader->fileinfo('filename');
            }
        }
        if ($my_uploader->upload_failed()) {
            $error[] = $my_uploader->get_error();
        }
    } elseif (!empty($pic) && preg_match(URL_REGEXP, $pic)) {
        $my->pic = checkRemotePic($pic, $my->id);
        switch ($my->pic) {
            case REMOTE_INVALID_URL:
                $error[] = $lang->phrase('editprofile_pic_error1');
                $my->pic = '';
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:editprofile.php


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