You are here

function _mass_contact_process_mime_mail_attachments in Mass Contact 6

Same name and namespace in other branches
  1. 5.2 mass_contact.module \_mass_contact_process_mime_mail_attachments()
  2. 7 mass_contact.page.inc \_mass_contact_process_mime_mail_attachments()

Process attachments for use with Mime Mail.

Return value

The attachment information, as Mime Mail expects it.

1 call to _mass_contact_process_mime_mail_attachments()
mass_contact_mail_page_submit in ./mass_contact.module
Processes the main Mass Contact mail form.

File

./mass_contact.module, line 2239
This is the main code file for the Mass Contact module. This module enables users to contact multiple users through selected roles.

Code

function _mass_contact_process_mime_mail_attachments() {

  // Set an initial value.
  $files = array();

  // Loop through each possible attachment.
  for ($i = 1; $i <= variable_get('mass_contact_number_of_attachments', '3'); $i++) {

    // Check to see if the attachment exists.
    if ($_FILES['files']['size']['attachment_' . $i] > 0) {
      $files[] = array(
        'filepath' => $_FILES['files']['tmp_name']['attachment'],
        'filename' => $_FILES['files']['name']['attachment'],
        'filemime' => $_FILES['files']['type']['attachment'],
      );
    }
  }
  return $files;
}