public function DoUploadImg(LJL_Request $input, LJL_Response $output) { $upfile = $input->files('uppic'); //客户端传过来的文件 $pos = strpos($upfile['name'], '.') + 1; $ext = substr($upfile['name'], $pos); //获取后缀名 $typelist = array("gif", "jpg", "png"); //限制图片类型 $imgInfo = LJL_Api::run("Image.DFS.imgStorage", array('rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/')); $path = $imgInfo[2]; //上传到该文件夹 $webPath = Helper_Blog::getImgWebPath($imgInfo[2]); if (!is_dir($path)) { LJL_File::mkdir($path); } //获取图片名 $picName = $imgInfo[0]; $result = $this->uploadFile($upfile, $path, $picName, $webPath, $typelist); //图片上传函数 if ($result['status']) { //图片表中插入数据 $imgid = Helper_Blog::insertPic(array('picName' => $picName, 'picExt' => $ext, 'time' => $imgInfo[1])); echo '<script language="javascript">window.parent.addPic("' . $result['info'] . '","' . $imgid . '");</script>'; } else { echo '<script language="javascript">window.parent.addPic("error","0");</script>'; } }