PMCORE-4120

This commit is contained in:
Julio Cesar Laura Avendaño
2023-01-19 17:28:14 +00:00
parent e264e67595
commit d844c13055
3 changed files with 33 additions and 9 deletions

View File

@@ -676,23 +676,23 @@ function saveAppDocument($file, $appUid, $appDocUid, $version = 1, $upload = tru
$info = pathinfo($file["name"]);
$extension = ((isset($info["extension"])) ? $info["extension"] : "");
$fileName = $appDocUid . "_" . $version . "." . $extension;
$pathCase = PATH_DATA_SITE . 'files' . PATH_SEP . G::getPathFromUID($appUid) . PATH_SEP;
$pathFile = $pathCase . $fileName;
$response = false;
if ($upload) {
G::uploadFile(
$file["tmp_name"],
$pathCase,
$fileName
);
$response = true;
} else {
G::verifyPath($pathCase, true);
$response = copy($file["tmp_name"], $pathCase . $fileName);
if (!copy($file["tmp_name"], $pathCase . $fileName)) {
$pathFile = '';
}
}
return $response;
return $pathFile;
} catch (Exception $e) {
throw $e;
}