|
|
|
@ -19,15 +19,15 @@ class UploadController extends Controller |
|
|
|
{ |
|
|
|
$image = $request->file('image'); |
|
|
|
if (!$image->isValid()) { |
|
|
|
return $this->error('未获取到任何文件'); |
|
|
|
return $this->error('您未上传任何文件'); |
|
|
|
} |
|
|
|
|
|
|
|
$mime = $image->getMimeType(); |
|
|
|
if (!in_array($mime, ['image/jpeg', 'image/png', 'image/gif', 'image/pjpeg'])) { |
|
|
|
return $this->error('所上传图片格式错误'); |
|
|
|
return $this->error('上传的图片格式错误'); |
|
|
|
} |
|
|
|
|
|
|
|
$path = $request->image->store('images', 'uploads'); |
|
|
|
$path = $request->image->store('images/' . $this->agent_id . '/' . $this->user_id, 'uploads'); |
|
|
|
return $this->success(['path' => env('APP_URL') . $this->save_path . $path]); |
|
|
|
} |
|
|
|
} |