function up() { $id = $this->_post('id', 'img_url'); $ids = $this->_post('ids', 0); $dir = $this->_get('path', ''); if (!checkPath($dir)) { $dir = 'user'; } if (isHave($_FILES['upimg']) && !isHave($_FILES['upimg']['error'])) { load('upload'); $myUpload = new Myupload(); $upload = $myUpload->upload($dir . '/u' . steadmin::$adminInfo['user_id']); $upload = parent::_sendImageToYunServer($upload); //同步图片到云存储 if ($upload) { if (!$upload[0]) { echo "<script>alert('" . $myUpload->getErrorMsg() . "');history.go(-1);</script>"; exit; } $upload[0]['savepath'] = str_replace('./', '', $upload[0]['savepath']); echo "<script>window.parent.document.getElementById('" . $id . "').value='" . $upload[0]['savepath'] . "';\r\n"; echo "window.location.href='" . U('upload/index', array('id' => $id, 'ids' => $ids, 'path' => $dir)) . "';</script>\r\n"; exit; } } else { echo "<script>alert('" . $_FILES['upimg']['error'] . "');history.go(-1);</script>"; exit; } }
/** * * 静态方法, 单例统一访问入口 * * @return object 返回对象的唯一实例 * */ public static function getInstance() { if (is_null(self::$_instance) || !isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }