|
@@ -3,7 +3,7 @@ discard block |
|
|
block discarded – undo |
|
3
|
3
|
require(__DIR__ . "/func.php"); |
|
4
|
4
|
|
|
5
|
5
|
return function($type, $allowedFileTypes) { |
|
6
|
|
- if(isset($_SESSION['user'])) { |
|
|
6
|
+ if (isset($_SESSION['user'])) { |
|
7
|
7
|
$fileType = strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)); |
|
8
|
8
|
$target_dir = __DIR__ . "/../dynamic/" . $type . "/"; |
|
9
|
9
|
$target_name = md5_file($_FILES["fileToUpload"]["tmp_name"]) . "." . $fileType; |
|
@@ -18,7 +18,7 @@ discard block |
|
|
block discarded – undo |
|
18
|
18
|
$movedFile = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file); |
|
19
|
19
|
} |
|
20
|
20
|
|
|
21
|
|
- if(!in_array($fileType, $allowedFileTypes)) { |
|
|
21
|
+ if (!in_array($fileType, $allowedFileTypes)) { |
|
22
|
22
|
echo 'unsupported file type. must be one of ' . join(", ", $allowedFileTypes) . '<hr>'; |
|
23
|
23
|
$uploadOk = 0; |
|
24
|
24
|
} |
Please login to merge, or discard this patch.