I'm trying to use mime->addAttachment() to add an attachmen to an email i'm about to send
relative path: ../../clientdata/client1/attachments/file.txt
direct path: /home/hosting/site.eu/html/ssl/clientdata/client1/attachments/file.txt
script location: /home/hosting/site.eu/html/ssl/work/php_scripts/send_email.php
send_email.php is executed using:
exec("php /home/hosting/site.eu/html/ssl/work/php_scripts/send_email.php");
Is there something I'm missing here?
The code i'm using to add the attachment:
$f = 'ssl.site.eu/clientdata/client1/attachments/file1.txt';
$arr_file = explode('/', $f, 2);
$file_path = '/home/hosting/site.eu/html/ssl/'.$arr_file[1]; //this works
// $file_path = '../../'.$arr_file[1]; // this doesn't work;
$mime->addAttachment($file_path,'application/octet-stream');
Beware the working directory of your process.
Now does the following code give the currect path?
echo getcwd().$relative_path;