docusign / docusign-esign-php-client

The Official Docusign PHP Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
https://www.docusign.com/devcenter
MIT License
197 stars 124 forks source link

getDocument : SplFileObject::__construct(): Filename cannot be empty #185

Closed marimuthum17 closed 1 year ago

marimuthum17 commented 1 year ago

Hi Team,

I am trying to download the getDocument, I am getting below error. SplFileObject::__construct(): Filename cannot be empty Code:

$tmpFile = $envelope_api->getDocument($account_id, '1', $envelope_id);
file_put_contents("my_document.pdf", file_get_contents($tmpFile->getPathname()));

Please advice....

kamran-DS commented 1 year ago

Are you able to get the document from the getDocument call ? You should be able to get an API trace for the request and response of your API call by following the process below.

https://support.docusign.com/s/document-item?language=en_US&rsc_301=&bundleId=jux1643235969954&topicId=poz1578456669909.html&_LANG=enus

If you are having issues with the DocuSign API, please open a ticket at support.docusign.com.

marimuthum17 commented 1 year ago

I can see the log "09_OK_RequestPDF.txt" But documents not coming. Seems to be a package issue, because error says "Filename cannot be empty", and also I can see the filename & encodedPDF content in log. Attached the log file. 09_OK_RequestPDF.txt

marimuthum17 commented 1 year ago

I was able to reproduce the error from my side adding an invalid path for my temp folder with PHP 7.4.9 (last 7.x version available for download).

Fixing to use a valid temp folder in my php.ini I was able to fix it but keep in mind that we strongly recommend to use PHP later versions to use this SDK (in case you are using something older than 7.4.x).

So check if the temp folders are properly defined in your environment (and you have read/write permissions on it) plus if upload_max_filesize and post_max_size have at least 2M as their values.

Fixed by adding sys_temp_dir="/Applications/XAMPP/xamppfiles/temp/" in my php.ini