What is the content type for pdf while creating attachment via connect PHP/Rest API?
Content
Hi All,
Please let me know whats the content type for pdf while creating the file attachment?
I have tried with the following lines,
$fattach->ContentType = "application/pdf;
$fattach->ContentType = "application/x-pdf;
The file getting created and attached to the incident successfully, but when I open its showing the attached error,
Version
Aug 2017Code Snippet
$dynamic_content="Sample content to create PDF file from CPHP"; $incident=RNCPHP\Incident::fetch(1059); $incident->FileAttachments =new RNCPHP\FileAttachmentIncidentArray(); $fattach = new RNCPHP\FileAttachmentIncident(); $fattach->ContentType = "application/pdf"; $fp = $fattach->makeFile(); fwrite( $fp, "$dynamic_content"); fclose( $fp ); $fattach->FileName = "NewTextFile".date("Y-m-d_h_i_s").".pdf"; $fattach->Name = "New Text File ".date("Y-m-d h:i:s").".pdf"; $incident->FileAttachments[] = $fattach; $incident->save();
Tagged:
2