Rearranged files
So, now it all works standalone without any dependencies on external resources.
This commit is contained in:
+4
-4
@@ -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}\""));
|
||||
|
||||
Reference in New Issue
Block a user