PMCORE-1585

This commit is contained in:
Paula Quispe
2020-06-10 12:15:01 -04:00
parent 0257afebb2
commit 5dbaae523f
9 changed files with 227 additions and 61 deletions

View File

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