Prepare file upload API (references #58)

This commit is contained in:
Bernd Bestel
2018-09-27 14:01:00 +02:00
parent 596dc9e36d
commit 9c2c2c1fa2
5 changed files with 142 additions and 0 deletions

31
services/FilesService.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace Grocy\Services;
class FilesService extends BaseService
{
public function __construct()
{
parent::__construct();
$this->StoragePath = GROCY_DATAPATH . '/storage';
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
}
}
private $StoragePath;
public function GetFilePath($group, $fileName)
{
$groupFolderPath = $this->StoragePath . '/' . $group;
if (!file_exists($groupFolderPath))
{
mkdir($groupFolderPath);
}
return $groupFolderPath . '/' . $fileName;
}
}