Commit cdcdc312 authored by shajiaiming's avatar shajiaiming

fix

parent 2c07238e
......@@ -22,7 +22,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
$this->msg = '上传失败';
$this->code = -1;
......
......@@ -19,7 +19,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
return ['code' => 1, 'msg' => '上传失败'];
}
......
......@@ -23,7 +23,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
$msg = '上传失败';
$code = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment