初出茅庐的图片上传的封装-- -- --面向对象
//今天才学的 留作纪念吧 //upload.php <?php class Upload { private $filename;//文件名 private $type;//文件类型 private $fileerror;//文件错误 private $allowsize;//允许的文件大小 private $allowtype;//允许的类型 private $path;//路径 private $newsname;//文件新名称 private $tmpname;//缓存文件名称 private $filetypes;//后缀名 private $seterror;//错误 function __construct($files,$path) { $this->filename=$files['name']; $types=explode(".",$this->filename);//根据.截取文件的后缀名称(.jpg) $this->filetypes=$types[count($types)-1];//后缀名称(jpg) $this->fileerror=$files['error']; $this->allowtype=array("jpg","png","gif","bmp","jpeg"); $this->allowsize=2000000; $this->path