PHP Uploader - UploadDir选项的问题

时间:2016-12-28 12:14:34

标签: php jquery

大家好,并提前感谢您的支持;)

我正在使用插件https://github.com/CreativeDream/jQuery.filer,用于PHP Uploader,在/php/class.uploader.php中我试图在下面的函数中更改上传目录:

    private function initialize($field, $options){
        if(is_array($field) && in_array($field, $_FILES)){
            $this->field = $field;
            $this->field['Field_Name'] = array_search($field, $_FILES);
            $this->field['Field_Type'] = 'input';

            if(!is_array($this->field['name'])){
            $this->field = array_merge($this->field, array("name" => array($this->field['name']), "tmp_name"=>array($this->field['tmp_name']), "type"=>array($this->field['type']), "error"=>array($this->field['error']), "size"=>array($this->field['size'])));
            }

            foreach($this->field['name'] as $key=>$value){ if(empty($value)){ unset($this->field['name'][$key]); unset($this->field['type'][$key]); unset($this->field['tmp_name'][$key]); unset($this->field['error'][$key]); unset($this->field['size'][$key]); } }

            $this->field['length'] = count($this->field['name']);
        }elseif(is_string($field) && $this->isURL($field)){
            $this->field = array("name" => array($field), "size"=>array(), "type"=>array(), "error"=>array());
            $this->field['Field_Type'] = 'link';
            $this->field['length'] = 1;
        }else{
            return false;
        }

        if($options != null){
            $this->setOptions($options);
        }
        $varuser='test';
        //$varuser=$_SESSION['username'];
        $this->options['uploadDir']="../../../uploads/".$varuser."/";

        return $this->prepareFiles();
    }

正如您所看到的,在功能结束时我设置了"选项" UploadDir就像" ../../../ uploads /" + $ varuser +" /",并使用$ varuser的当前定义($ varuser =' test')一切正常。

但是,当我尝试分配给$ varuser我的会话用户名变量时,我的问题开始了,我收到了custom.js中的错误:91(/ examples / dragdrop / js)

请知道发生了什么事?

谢谢;)

0 个答案:

没有答案