> 下面是一个简单的上传头像的演示 ```php //载入扩展 extend('UploadFile.class.php'); //实例化上传类库 $upload = new \Upload(); //判断客户端是否有上传file[head] if (!empty($_FILES['head'])) { //上传并保存到指定目录 if (!$upload->upload('Upload/head')) { //失败反馈原因 return $upload->getErrorMsg(); } //上传成功返回路径 $headInfos = $upload->getUploadFileInfo(); return $headInfos[0]['savepath'] . $headInfos[0]['savename']; } ```