Fix client file upload not automatically naming files or showing image previews

This commit is contained in:
Marcus Hill
2023-04-08 20:48:55 +01:00
parent c2b25cbf7d
commit 9f25b436d6
+8
View File
@@ -7044,6 +7044,14 @@ if(isset($_POST['add_file'])){
$client_id = intval($_POST['client_id']);
$file_name = sanitizeInput($_POST['new_name']);
$extarr = explode('.', $_FILES['file']['name']);
$file_extension = sanitizeInput(strtolower(end($extarr)));
// If the user-inputted name is empty, revert to the name of the file on disk/uploaded
if (empty($file_name)) {
$file_name = sanitizeInput($_FILES['file']['name']);
}
if (!file_exists("uploads/clients/$client_id")) {
mkdir("uploads/clients/$client_id");
}