Vedhæft fil on the fly
Hej,Jeg genererer en rft fil med følgende kode:
// including main script file:
include "rtf_class.php";
// this will be the name of our RTF file:
$navn = "filnavn";
$file_rtf = "$navn.rtf";
// HTTP headers saying that it is a file stream:
Header("Content-type: application/octet-stream");
// passing the name of the streaming file:
Header("Content-Disposition: attachment; filename=$file_rtf");
// here is the text of our RTF file:
// creating class object and passing to it the path to configuration file:
$rtf = new RTF("rtf_config.inc");
// passing the text to the object:
$rtf->parce_HTML($html_text);
// getting RTF code:
$fin = $rtf->get_rtf();
// streaming the file to the user:
echo $fin;
Jeg har nu brug for at vedhæfte filen en mail. Filen indlæses i denne variabel, i det script jeg normalt bruger til at sende vedhæftede filer med:
$fil_var = fread(fopen($_FILES['fileatt']['tmp_name'], "r"), filesize($_FILES['fileatt']['tmp_name']));
Men jeg ved ikke helt hvordan jeg kobler de 2 ting sammen :)