2017-01-06 08:13
浏览 82

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))); 

图片转代码服务由CSDN问答提供 功能建议

我正在使用模拟账户。 我正在通过Rest API使用 PHP 连接到 签署文件。

当我上传 pdf 文档时,它工作正常,但是当我上传任何其他类型的文档时,它会出错。 任何人都可以确认错误是否是由于模拟账户造成的。


 致命错误:未捕获的异常'DocuSign  \ eSign \ ApiException'带消息

我使用了开发者页面中显示的代码。 \ n


 $ documentFileName =“/ test / Docs / test.docx”;  
 $ documentName =“test.pdf”;  
 $ envelopeApi = new DocuSign \ eSign \ Api \ EnvelopesApi($ apiClient);  
 $ document = new DocuSign \ eSign \ Model \ Document();  
 $ document-> setDocumentBase64(base64_encode(file_get_contents(DIR。$ documentFileName)));  
 $ document-> setName($ documentName); 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongli5785 2017-01-07 22:09

    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.

    解决 无用
    打赏 举报

相关推荐 更多相似问题