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


PHP upload_rename函数代码示例

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


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

示例1: upload

function upload($upload, $target = './', $exts = 'jpg,gif,torrent,zip,rar,7z,doc,docx,xls,xlsx,ppt,pptx,mp3,wma,swf,flv,txt', $size = 20, $rename = '')
{
    mk_dir($target);
    if (is_array($upload['name'])) {
        $return = array();
        foreach ($upload["name"] as $k => $v) {
            if (!empty($upload['name'][$k])) {
                $ext = get_ext($upload['name'][$k]);
                if (strpos($exts, $ext) !== false && $upload['size'][$k] < $size * 1024 * 1024) {
                    $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext);
                    if (upload_move($upload['tmp_name'][$k], $target . $name)) {
                        $return[] = $name;
                    }
                }
            }
        }
        return $return;
    } else {
        $return = '';
        if (!empty($upload['name'])) {
            $ext = get_ext($upload['name']);
            if (strpos($exts, $ext) !== false && $upload['size'] < $size * 1024 * 1024) {
                $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext);
                if (upload_move($upload['tmp_name'], $target . $name)) {
                    $return = $name;
                }
            }
        }
    }
    return $return;
}
开发者ID:q275957304,项目名称:huanshou,代码行数:31,代码来源:function.php

示例2: session_destroy

    $page_name = "upload";
    // Include header if "on" in config.php.
    if ($head == "on") {
        include "header.php";
    }
    session_destroy();
    session_unset($_SESSION['pass_hash_upload']);
    echo "<script type=\"text/javascript\">\n<!--\nvar URL   = \"DoorHangers.php\"\nvar speed = {$edit_redirect}\nfunction reload() {\nlocation = URL\n}\nsetTimeout(\"reload()\", speed);\n//-->\n</script>";
    echo "{$p}\n{$l_global10}\n{$p2}\n{$p}\n{$l_global11}\n{$p2}";
    // Include footer if "on" in config.php.
    if ($head == "on") {
        include "footer.php";
    }
}
switch (@$_REQUEST['cmd']) {
    default:
        upload1();
        break;
    case "upload2":
        upload2(@$_POST['ftp_file'], @$_POST['upload_type'], $_POST['submit']);
        break;
    case "upload_delete":
        upload_delete($_POST['file'], $_POST['pg']);
        break;
    case "upload_rename":
        upload_rename($_POST['file'], $_POST['upload_newname'], $_POST['pg']);
        break;
    case "logout":
        logout();
        break;
}
开发者ID:JasonAJames,项目名称:jasonajamescom,代码行数:31,代码来源:DoorHangers.php


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