3.1.2上传类不支持自定义子目录名称?

浏览:665 发布日期:2012/11/23 分类:技术分享 关键字: 上传 3.1.2
上传方法中开启子目录上传$upload->autoSub = true;
 $upload->subType = 'custom';//ROOT_PATH."/data/user/{$_COOKIE['user']['id']}/       
$upload->custom = $_COOKIE['user']['id'];
修改上传类private function getSubName($file) {
        
        switch($this->subType) {
            //自定义创建目录方式
            
            case 'custom':
                $dir = $this->custom;
                break;
            case 'date':
                $dir    =   date($this->dateFormat,time()).'/';
                break;
            case 'hash':
            default:
                $name   =   md5($file['savename']);
                $dir    =   '';
                for($i=0;$i<$this->hashLevel;$i++) {
                    $dir   .=  $name{$i}.'/';
                }
                break;
        }
最佳答案
评论() 相关
后面还有条评论,点击查看>>