Answer the question
In order to leave comments, you need to log in
How to attach a CFile::SaveFile file?
I need a file that the file was converted from html to pdf by file_put_contents to send to the mail with the document attached.
The files documentation says that I should use CFile. I started using it
$output = $dompdf->output();
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/upload/payment/'.$_GET['ORDER_ID'].'.pdf', $output);
$file = CFile::SaveFile(
$output,
$_SERVER['DOCUMENT_ROOT'].'/upload/payment/'.$_GET['ORDER_ID'].'.pdf',
false,
false
);
Answer the question
In order to leave comments, you need to log in
$file = CFile::MakeFileArray(
$_SERVER['DOCUMENT_ROOT'].'/upload/payment/'.$_GET['ORDER_ID'].'.pdf',
false,
false,
''
);
$fileSave = CFile::SaveFile(
$file,
'/payment',
false,
false
);
CEvent::Send(
'SEND_PAY_PDF',
's1',
array('EMAIL_TO' => $USER->getEmail()),
'N',
'',
array($fileSave),
'ru'
);
First, tell me if the file itself is saved?
Use the file id received in the previous step to send an email using this method: https://dev.1c-bitrix.ru/api_help/main/reference/c...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question