Rearranged files

So, now it all works standalone without any dependencies on external resources.
This commit is contained in:
Masahiko AMANO
2021-12-11 00:29:21 +03:00
parent f63cb6cb59
commit 309521897b
7 changed files with 18 additions and 10 deletions
+4 -4
View File
@@ -4,11 +4,11 @@ $file = $_FILES['file'];
if (!is_dir('./files')) {
mkdir('./files');
}
if (!file_exists('./counter.txt')){
file_put_contents('./counter.txt', '0');
if (!file_exists('./files/counter.txt')){
file_put_contents('./files/counter.txt', '0');
}
$id = (int)file_get_contents('./counter.txt');
file_put_contents('./counter.txt', (string)($id+1));
$id = (int)file_get_contents('./files/counter.txt');
file_put_contents('./files/counter.txt', (string)($id+1));
$path = "./files/{$id}__".basename($file['name']);
move_uploaded_file($file['tmp_name'], $path);
$result = json_decode((string)shell_exec(dirname(__file__)."/huffman.py -".($mode == 'compress' ? 'c' : 'd')." \"{$path}\""));