1
0
mirror of https://github.com/flarum/core.git synced 2025-10-21 11:46:05 +02:00

Add simple implementation (command handler) for avatar upload.

This commit is contained in:
Franz Liedke
2015-03-25 14:23:31 +01:00
parent 7f66a77ede
commit a1f723671d
3 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php namespace Flarum\Core\Commands;
use RuntimeException;
class UploadAvatarCommand
{
public $userId;
/**
* @var \Symfony\Component\HttpFoundation\File\UploadedFile
*/
public $file;
public $actor;
public function __construct($userId, $file, $actor)
{
if (empty($userId) || !intval($userId)) {
throw new RuntimeException('No valid user ID specified.');
}
if (is_null($file)) {
throw new RuntimeException('No file to upload');
}
$this->userId = $userId;
$this->file = $file;
$this->actor = $actor;
}
}