mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-17 09:48:41 +00:00
fix languages
This commit is contained in:
parent
fd1b8b7d5f
commit
98942d585f
|
|
@ -140,6 +140,19 @@ final class ApiController extends Controller
|
||||||
return $this->createDbEntries($status, $account, $virtualPath, $type);
|
return $this->createDbEntries($status, $account, $virtualPath, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function uploadFilesToDestination(
|
||||||
|
array $files,
|
||||||
|
string $name = '',
|
||||||
|
string $path = '',
|
||||||
|
) : array {
|
||||||
|
$upload = new UploadFile();
|
||||||
|
$upload->setOutputDir($path);
|
||||||
|
|
||||||
|
$status = $upload->upload($files, $name, true, '');
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a random file path to store media files
|
* Create a random file path to store media files
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ class UploadFile
|
||||||
$this->outputDir = $this->findOutputDir();
|
$this->outputDir = $this->findOutputDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $this->outputDir;
|
$path = empty($this->outputDir) ? $f['tmp_name'] : $this->outputDir;
|
||||||
|
|
||||||
foreach ($files as $key => $f) {
|
foreach ($files as $key => $f) {
|
||||||
$result[$key] = [];
|
$result[$key] = [];
|
||||||
|
|
@ -158,6 +158,7 @@ class UploadFile
|
||||||
$result[$key]['filename'] = $this->fileName;
|
$result[$key]['filename'] = $this->fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @todo: find a way to allow upload to default temp directory, maybe check if $path is empty, if empty don't change directory, just keep it in the temp directory
|
||||||
if (empty($this->fileName) || \is_file($path . '/' . $this->fileName)) {
|
if (empty($this->fileName) || \is_file($path . '/' . $this->fileName)) {
|
||||||
try {
|
try {
|
||||||
$this->fileName = $this->createFileName($path, $f['tmp_name'], $extension);
|
$this->fileName = $this->createFileName($path, $f['tmp_name'], $extension);
|
||||||
|
|
@ -222,7 +223,7 @@ class UploadFile
|
||||||
//FileUtils::changeFileEncoding($dest, $encoding);
|
//FileUtils::changeFileEncoding($dest, $encoding);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$result[$key]['path'] = \realpath($this->outputDir);
|
$result[$key]['path'] = $this->outputDir === '' ? $f['tmp_name'] : \realpath($this->outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user