Home > Backend Development > PHP Tutorial > 小弟我的这个文件上传 类中的input里面的name为什么不能等于数组

小弟我的这个文件上传 类中的input里面的name为什么不能等于数组

WBOY
Release: 2016-06-13 12:44:48
Original
928 people have browsed it

我的这个文件上传 类中的input里面的name为什么不能等于数组?
class SyFile {
    private $_upl_dir;
    private $_refu_type;
    private $_acce_type;
    private $_errno = 0;
    private $_ext;
    
    public function __construct( $_upl_dir = '../upload', $size = 8388608 ) {
        $this->_upl_dir = $_upl_dir;
        if ( is_numeric( $_size ) ) @ini_set('upload_max_filesize',intval($_size));
        $this->check_upload_dir();
    }
    
    /**
     * set the accept file extension
     * @param $acce_type;
    */
    public function set_accept_type( $acce_type ) {
        $this->_acce_type = $acce_type;
    }
    /**
     * set the refuse file extension
     * @param $refuse_type;
    */
    public function set_refuse_type( $refuse_type ) {
        $this->_refu_type = $refuse_type;
    }
    
    /**
     * handing the files from the speicified file input .

     * @param $name (the file input name )
     * @param $over (if isn't overwrite the file)
    */
    public function upload( $name,$_prefix = '', $over = true) {
        $_error = $_FILES[''.$name.'']['error'];
        $_local = $_FILES[''.$name.'']['name'];
        $_temp  = $_FILES[''.$name.'']['tmp_name'];
        $_files = NULL;
        
        $_size = count($_local);
        if ( $_error != 0 ) return $_files;
        $this->isLegal($_local);
        if ( $this->_errno != 0 ) return $_files;
        if ( $over && is_uploaded_file( $_temp ) ) {
            $file = $this->generate( $_prefix );
            if ( move_uploaded_file( $_temp, $this->_upl_dir.'/'.$file ) )
            $_files = $file;
        }
        return $_files;
    }
    

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template