Attachment Timeout

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

madmike wrote:That is the way it is setup.

handler_form.php
/tmp
/lib/Swift/

Should I move the "/tmp" into the "/lib" folder? Another question, Do you have a tutorial on multiple attachments? I can not get mine to work. If you don't have one, I'll open a new post with my code.
Multiple attachments is just a case of slightly adjusting the exisiting code to deal with the multi-dimensional array:

Code: Select all

File 1: <input type="file" name="attachment[]" />
File 2: <input type="file" name="attachment[]" />

Code: Select all

if (!empty($_FILES["attachment"])) {
  //Each element in $_FILES becomes a multidimensional array
  foreach ($_FILES["attachment"]["tmp_name"] as $key => $value) {
    if (!$_FILES["attachment"]["error"][$key]) {
      $message->attach(new Swift_Message_Attachment(
        new Swift_File($value), $_FILES["attachment"]["name"][$key], $_FILES["attachment"]["type"][$key]));
    }
  }
}
Moving tmp to the lib folder shouldn't really make a difference... I'm not really sure what's causing your problem I'm afraid.
Post Reply