You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

What is the content type for pdf while creating attachment via connect PHP/Rest API?

Accepted answer
edited May 7, 2018 9:30AM in UI Extensibility 9 comments


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,



Aug 2017

Code Snippet

             $dynamic_content="Sample content to create PDF file from CPHP";
$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;

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!