面向对象方式编写文件上传类
uploadPic.class.php
<?php
/**
文件上传类
*/
class uploadPic
{
// 定义成员变量
private $allow_type = array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif');
private $max_size = 1048576;
private $upload_path = 'C:/wamp/www/phpProj/upload/';
private $error = '';
/**
构造方法
$param 用来修改成员属性的数组数据
*/
public function __construct($param)
{
if (isset($param['allow_type'])) $this->allow_type = $param['types'];
if (isset($param['max_size'])) $this->max_size = $param['size'];
if (isset($param['upload_path'])) $this->upload_path = $param['path'];
}
/**文件上传函数
* $file 包含文件上传的5个信息数据
* $prefix 前缀
*/
public function