public function uploadYunyingMedia($file) { if (empty($file)) { $this->setError(ErrorConf::yunyingMediaEmpty()); return false; } $obj = new alioss_sdk(); $obj->set_debug_mode(FALSE); $bucket = $this->OSS_BUCKET_IMAGE; $tmpFile = $file['tmp_name']; $ext = array_search($file['type'], MimeTypes::$mime_types); if (!in_array($ext, $this->OSS_IMAGE_ENABLE)) { $ext = "jpg"; } $filemd5 = md5_file($tmpFile); $from = "{$this->LOCAL_TMP_PATH}{$filemd5}.{$ext}"; move_uploaded_file($tmpFile, $from); $to = "yunying/{$filemd5}.{$ext}"; $responseObj = $obj->upload_file_by_file($bucket, $to, $from); if ($responseObj->status == 200) { list($width, $height, $type, $attr) = getimagesize($from); $return['path'] = $to; $return['width'] = $width; $return['height'] = $height; return $return; } else { $this->setError(ErrorConf::yunyingMediaError()); return false; } }