From a95b32a57ee98a061ad693e66c40c381bdf6887b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 23 Aug 2023 16:10:15 -0400 Subject: [PATCH] Upon upload the file contents are not hashed in Sha256 and used for the reference file in the DB --- functions.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/functions.php b/functions.php index 03e34eaf..8e83db1e 100644 --- a/functions.php +++ b/functions.php @@ -636,16 +636,13 @@ function checkFileUpload($file, $allowed_extensions) { } // Read the file content - //$fileContent = file_get_contents($tmp); + $fileContent = file_get_contents($tmp); // Hash the file content using SHA-256 - //$hashedContent = hash('sha256', $fileContent); + $hashedContent = hash('sha256', $fileContent); // Generate a secure filename using the hashed content - //$secureFilename = $hashedContent . '.' . $extension; - - // Generate a secure filename using SHA-256 - $secureFilename = hash('sha256', time() . $name) . '.' . $extension; + $secureFilename = $hashedContent . '.' . $extension; return $secureFilename; }