mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Allow contacts to upload attachments when adding ticket replies in portal
- Adds the ability for contacts to add file attachments when posting a ticket reply - Enhancements to checkFileUpload(): Adjust file reference name generation & bad extension handling
This commit is contained in:
@@ -628,12 +628,14 @@ function checkFileUpload($file, $allowed_extensions) {
|
||||
|
||||
// Check a file is actually attached/uploaded
|
||||
if ($tmp === '') {
|
||||
return "No file was uploaded.";
|
||||
// No file uploaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the extension is allowed
|
||||
if (!in_array($extension, $allowed_extensions)) {
|
||||
return "File extension not allowed.";
|
||||
// Extension not allowed
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the size is under 500 MB
|
||||
@@ -649,7 +651,7 @@ function checkFileUpload($file, $allowed_extensions) {
|
||||
$hashedContent = hash('sha256', $fileContent);
|
||||
|
||||
// Generate a secure filename using the hashed content
|
||||
$secureFilename = $hashedContent . '.' . $extension;
|
||||
$secureFilename = $hashedContent . randomString(2) . '.' . $extension;
|
||||
|
||||
return $secureFilename;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user