Fix client file upload not automatically naming files or showing image previews
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user