Fix bug in multiple file upload example, fixes #2569

This commit is contained in:
Marcus Bointon 2021-11-28 14:39:03 +01:00
parent baeb7cde6b
commit d3f566012b
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ if (array_key_exists('userfile', $_FILES)) {
//Attach multiple files one by one
for ($ct = 0, $ctMax = count($_FILES['userfile']['tmp_name']); $ct < $ctMax; $ct++) {
//Extract an extension from the provided filename
$ext = PHPMailer::mb_pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);
$ext = PHPMailer::mb_pathinfo($_FILES['userfile']['name'][$ct], PATHINFO_EXTENSION);
//Define a safe location to move the uploaded file to, preserving the extension
$uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'][$ct])) . '.' . $ext;
$filename = $_FILES['userfile']['name'][$ct];