Heim > Artikel > Backend-Entwicklung > 小弟我的这个文件上传 类中的input里面的name为什么不能等于数组
我的这个文件上传 类中的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;
}