docusign api不上传docx或doc文件

I am using a demo account. I am connecting through Rest API using PHP to sign documents.

When I am uploading a pdf document it is working fine but when I upload any other type of document it is giving error. Can anyone confirm if the error is due to demo account.

Error I am receiving is:

Fatal error: Uncaught exception 'DocuSign\eSign\ApiException' with message 
[400] Error connecting to the API

I have used the codes displayed in the developer pages.

My code:

// configure the document we want signed 
$documentFileName = "/test/Docs/test.docx"; 

// working for test.pdf 
$documentName = "test.pdf"; 
// instantiate a new envelopeApi object 
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient); 
// Add a document to the envelope 
$document = new DocuSign\eSign\Model\Document(); 
$document->setDocumentBase64(base64_encode(file_get_contents‌​(DIR . $documentFileName))); 
$document->setName($documentName);

For file types other than pdf, you need to explicitly set the file type. This is done with the fileExtension field

Try adding

$document->setFileExtension("docx"); // Word docx file

See docs for the list of supported file types.