1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

sharing folder existance and rights check

This commit is contained in:
Jb Lm 2022-04-01 10:35:30 +02:00
parent 7f2730decb
commit f884eb73ae

View File

@ -169,6 +169,12 @@ $f3->route('POST /share',
$hash = substr(hash('sha512', uniqid().rand()), 0, 20); $hash = substr(hash('sha512', uniqid().rand()), 0, 20);
$sharingFolder = $f3->get('STORAGE').$hash."/"; $sharingFolder = $f3->get('STORAGE').$hash."/";
$f3->set('UPLOADS', $sharingFolder); $f3->set('UPLOADS', $sharingFolder);
if (!is_dir($f3->get('STORAGE'))) {
$f3->error(500, 'Sharing folder doesn\'t exist');
}
if (!is_writable($f3->get('STORAGE'))) {
$f3->error(500, 'Sharing folder is not writable');
}
mkdir($sharingFolder); mkdir($sharingFolder);
$filename = "original.pdf"; $filename = "original.pdf";
$tmpfile = tempnam($sharingFolder, date('YmdHis')); $tmpfile = tempnam($sharingFolder, date('YmdHis'));