mirror of
https://github.com/Lukas0025/YAGS.git
synced 2025-04-04 15:01:32 +01:00
Added support for chunk upload
This commit is contained in:
parent
75b6558063
commit
bbb5de3900
@ -132,14 +132,26 @@
|
||||
|
||||
$adir = __DIR__ . "/../ARTEFACTS/" . $params["id"];
|
||||
|
||||
$fname = basename($params["fname"]);
|
||||
|
||||
mkdir($adir, 0777, true);
|
||||
|
||||
$artefacts = $obs->artefacts->get();
|
||||
foreach ($_FILES as $file) {
|
||||
move_uploaded_file($file["tmp_name"], $adir . "/" . $file["name"]);
|
||||
$artefacts[] = "/ARTEFACTS/{$params['id']}/{$file['name']}";
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
$obs->artefacts->set($artefacts);
|
||||
$obs->commit();
|
||||
// file pointer
|
||||
$ifp = fopen($adir . "/" . $fname, 'ab');
|
||||
|
||||
fwrite($ifp, $params["data"]);
|
||||
|
||||
// clean up the file resource
|
||||
fclose($ifp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user