On Monday 09 February 2004 16:23, merlin wrote:

> there is following scenario:
> - One php file saved with .pdf extension
> - .htaccess tells php to parse this file
> - ?ID=x provides the database id for individual files
>
> That whole thing workes perfectly as long as you access it via browser
> and URL.
>
> Now I need to save those files, or send them as an email attachement.
> I am using a phpmailer class. When I try to access the file with the ?
> and parameters email transaction failes.
>
> $mail->AddAttachment('/invoice-sample.pdf?id='.$sl[ID], "invoice.pdf");

That is telling php to get the file '/invoice-sample.pdf?id=XXX...' through 
the local filesystem, ie not through HTTP, and as such it will not be 
parsed/interpreted by php.

> Has anybody an idea how to solve this or where the problem lives?

You need to open the file through HTTP, whether you can do that depends on 
your version of PHP and the platform it's running on.

If the phpmailer class can handle the opening of files via HTTP then it should 
be a simple:

$mail->AddAttachment('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], 
"invoice.pdf");

Otherwise you need to manually read in the file then feed it into 
$mail->AddAttachment (somehow)

So something like:

  fopen('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], 'r');

along with your favourite file reading function.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Nothing is so often irretrievably missed as a daily opportunity.
                -- Ebner-Eschenbach
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to