diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index ab8e36d1..05937433 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -171,10 +171,23 @@ if ($hesk_settings['attachments']['use']) { $attachments = array(); $trackingID = $tmpvar['trackid']; - for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { - $att = hesk_uploadFile($i); - if ($att !== false && !empty($att)) { - $attachments[$i] = $att; + $use_legacy_attachments = hesk_POST('use-legacy-attachments', 0); + + if ($use_legacy_attachments) { + for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { + $att = hesk_uploadFile($i); + if ($att !== false && !empty($att)) { + $attachments[$i] = $att; + } + } + } else { + // The user used the new drag-and-drop system. + $temp_attachment_ids = hesk_POST_array('attachment-ids'); + foreach ($temp_attachment_ids as $temp_attachment_id) { + // Simply get the temp info and move it to the attachments table + $temp_attachment = mfh_getTemporaryAttachment($temp_attachment_id); + $attachments[] = $temp_attachment; + mfh_deleteTemporaryAttachment($temp_attachment_id); } } } diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 74d23344..d3351af9 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -40,6 +40,7 @@ define('AUTOFOCUS', true); require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); +require(HESK_PATH . 'inc/view_attachment_functions.inc.php'); hesk_load_database_functions(); hesk_session_start(); @@ -1032,18 +1033,24 @@ if ($hesk_settings['attachments']['use']) {