From f2ce7a9d8d77d1d990d91e09b40aa9a9c9bb49b8 Mon Sep 17 00:00:00 2001 From: "johnny@pittpc.com" Date: Fri, 29 Jan 2021 10:35:18 -0500 Subject: [PATCH] Add check on edit user to see if User directory is created before Avatar upload --- post.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/post.php b/post.php index 2ca2577d..792be31f 100644 --- a/post.php +++ b/post.php @@ -80,6 +80,10 @@ if(isset($_POST['edit_user'])){ } $path = strip_tags(mysqli_real_escape_string($mysqli,$_POST['current_avatar_path'])); + if(!file_exists("uploads/users/$user_id")) { + mkdir("uploads/users/$user_id"); + } + if($_FILES['file']['tmp_name']!='') { //delete old avatar file unlink($path);