mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Prepare file upload API (references #58)
This commit is contained in:
31
services/FilesService.php
Normal file
31
services/FilesService.php
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user