viewtopic.php?f=52&t=67221&st=0&sk=t&sd ... s&start=15
post but I'll be honest, i really don't know what it's telling me to do. If anyone can help me understand this or show me a way to make the "Sending an e-mail from a form with Swift" work for multiple attachments I'd greatly appreciate it. here is the sections of code that I've deduced (great commenting with the code by the way) is dealing with the file attachments:
Code: Select all
<input type="file" name="attachment" /><input type="file" name="attachment" /><input type="file" name="attachment" /> Code: Select all
//Check if an attachment was uploaded
$file_path = false;
$file_name = false;
$file_type = false;
if (!empty($_FILES["attachment"]["tmp_name"]))
{
if ($_FILES["attachment"]["error"])
{
//Redirect if the upload has failed
header("Location: ./form.php?error=upload_failed");
exit();
}
$file_path = $_FILES["attachment"]["tmp_name"];
$file_name = $_FILES["attachment"]["name"];
$file_type = $_FILES["attachment"]["type"];
}
//second part of php
//If an attachment was sent, attach it
if ($file_path && $file_name && $file_type)
{
$message->attach(
new Swift_Message_Attachment(new Swift_File($file_path), $file_name, $file_type));
}