mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Support file upload in extra vars
This commit is contained in:
parent
d45c116c56
commit
50274a7f9b
2 changed files with 97 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ namespace Rhymix\Modules\Extravar\Models;
|
|||
|
||||
use BaseObject;
|
||||
use Context;
|
||||
use FileController;
|
||||
use ModuleModel;
|
||||
use Rhymix\Framework\DateTime;
|
||||
use Rhymix\Framework\i18n;
|
||||
|
|
@ -275,6 +276,25 @@ class Value
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file.
|
||||
*
|
||||
* @param array $file
|
||||
* @param int $target_srl
|
||||
* @param string $target_type
|
||||
* @return BaseObject
|
||||
*/
|
||||
public function uploadFile(array $file, int $target_srl, string $target_type): BaseObject
|
||||
{
|
||||
$oFileController = FileController::getInstance();
|
||||
$output = $oFileController->insertFile($file, $this->module_srl, $target_srl);
|
||||
if ($output->toBool())
|
||||
{
|
||||
$oFileController->setFilesValid($target_srl, "ev:$target_type", $output->get('file_srl'));
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next temporary ID.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue