mirror of
https://github.com/Lukas0025/YAGS.git
synced 2025-04-11 01:42:12 +01:00
Fix upload of artifacts
This commit is contained in:
parent
8301acf8f2
commit
1a0808b4c9
@ -126,9 +126,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addArtefacts($params) {
|
function addArtefacts($params) {
|
||||||
$obs = new \DAL\observation();
|
|
||||||
$obs->id->set($params["id"]);
|
|
||||||
$obs->fetch();
|
|
||||||
|
|
||||||
$adir = __DIR__ . "/../ARTEFACTS/" . $params["id"];
|
$adir = __DIR__ . "/../ARTEFACTS/" . $params["id"];
|
||||||
|
|
||||||
@ -136,22 +133,27 @@
|
|||||||
|
|
||||||
mkdir($adir, 0777, true);
|
mkdir($adir, 0777, true);
|
||||||
|
|
||||||
// chunk upload file
|
|
||||||
if ($params["offset"] == 0) {
|
|
||||||
// get current artifasts
|
|
||||||
$artefacts = $obs->artefacts->get();
|
|
||||||
|
|
||||||
$artefacts[] = "/ARTEFACTS/{$params['id']}/{$fname}";
|
|
||||||
|
|
||||||
$obs->artefacts->set($artefacts);
|
|
||||||
$obs->commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// file pointer
|
// file pointer
|
||||||
$ifp = fopen($adir . "/" . $fname, 'ab');
|
$ifp = fopen($adir . "/" . $fname, 'ab');
|
||||||
|
|
||||||
fwrite($ifp, $params["data"]);
|
fwrite($ifp, $params["data"]);
|
||||||
|
|
||||||
// clean up the file resource
|
// clean up the file resource
|
||||||
fclose($ifp);
|
fclose($ifp);
|
||||||
|
|
||||||
|
// chunk upload file
|
||||||
|
if ($params["offset"] != 0) return;
|
||||||
|
|
||||||
|
$obs = new \DAL\observation();
|
||||||
|
$obs->id->set($params["id"]);
|
||||||
|
$obs->fetch();
|
||||||
|
|
||||||
|
//get current artefacts
|
||||||
|
$artefacts = $obs->artefacts->get();
|
||||||
|
|
||||||
|
$artefacts[] = "/ARTEFACTS/{$params['id']}/{$fname}";
|
||||||
|
|
||||||
|
//done artefact save
|
||||||
|
$obs->artefacts->set($artefacts);
|
||||||
|
$obs->commit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user