beefcake
Posts: 11
|
Posted: 06/01/2016, 9:21 AM |
|
Hi All,
I am using php mailer to add attachment to email.
I am not able to get attachment working when I call file name from database. But works if I manually add in. For example
This works
$mail->addAttachment("CAUploads\\emailup\\201606011654390.Lighthouse.jpg");
$mail->addAttachment("CAUploads/emailup/201606011654390.Lighthouse.jpg");
This does not work
$up11 = CCDLookUp("up1", "tbl_reminders", "remind_id=".
$DBcamain->ToSQL($RecField, ccsText), $DBcamain);
$path = "CAUploads\\emailup\\".$up11;
$path1 = "CAUploads/emailup/".$up11;
$mail->addAttachment($path);
$mail->addAttachment($path1);
Any ideas why? I have printed $up11 and gives file name e.g.201606011654390.Lighthouse.jpg
|
|
|
eratech
Posts: 513
|
Posted: 06/08/2016, 11:45 PM |
|
@beefcake - at first glance it appears fine.
I would suggest checking the $path and $path1 is returning, not just $up11, and perhaps try single quotes instead of double quotes when concatenating them. PHP *might* by escaping something and getting the wrong file path.
See: http://php.net/manual/en/language.types.string.php
Cheers
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
beefcake
Posts: 11
|
Posted: 06/09/2016, 6:37 AM |
|
Thanks Eric.
I worked out the code was in fact fine but the file only gets picked up from the temporary upload folder! e.g. CAUploads/tmpup.
The email code is part of a records after insert event so I would expect the file transfer from temp to live to have already occurred.
|
|
|
|