Re: Problem with attaching file (from a form) to email in PHP [message #172787 is a reply to message #172782] |
Tue, 01 March 2011 09:44 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
Cameleon wrote:
> Thanks Jerry,
>
> thanks for the advice, but there is a lot more sanitizing done (found
> that already...), I just simplified the code for the forum. Worked
> for the <> ... stupid me, need new glasses!
>
> one last (I hope) question if you still want...
>
> 1) seems it doesn't want to access the file that I want to attached
> (posted from the form... see code below)
>
>
>
> // ATTACHENMENT INFOS
> $UploadedFile_name = $_FILES["UploadedFile"]["name"];
> $UploadedFile_type = $_FILES["UploadedFile"]["type"];
> $UploadedFile_size = $_FILES["UploadedFile"]["size"];
> $UploadedFile_temp = $_FILES["UploadedFile"]["tmp_name"];
>
>
> ive tried:
>
> $mail->AddAttachment(file_get_contents($UploadedFile_name));
>
> and
>
> $mail->AddAttachment($UploadedFile_name);
>
> with no success...
>
>
This *may* be another instance of an issue I found where a third party
program is invoked to access the temporary file. And that is, that the
scope of the temporary file only exists within PHP itself. It s not
written to disk or to the operating system.
I solved this by copying the temporary file using copy() and then
invoking (in my case) an SQL LOAD_FILE command on the _copy_.
Given that the php mailer class should exist entirely within PHP, this
should not be an issue in this case, but it may be if it invokes some
other program to process the attached file.
|
|
|