diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index f9167c379..8d3582c78 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -1,5 +1,5 @@ attach(array('file' => $inputFileName)) + ->sendsType(\Httpful\Mime::FORM) ->expectsJson() + ->body( + array( + 'options' => sprintf(self::JSON_FORMATS, $format) + ) + ) + ->attach(array('file' => $inputFileName)) ->send(); // Checks that: @@ -220,7 +227,7 @@ class DocsboxLib /** * Download the converted file using the provided URL, unzip it, and renames it into the provided file name */ - private static function _downloadFile($resultUrl, $outputFileName) + private static function _downloadFile($resultUrl, $outputFileName, $format) { $downloaded = false; // pessimistic assumption @@ -252,7 +259,7 @@ class DocsboxLib // Opened, extracted and closed! // Rename the extracted file to the given output file name - if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName)) + if (rename($outputDirectory.'/'.sprintf(self::OUTPUT_FILENAME, $format), $outputFileName)) { $downloaded = true; } @@ -260,7 +267,7 @@ class DocsboxLib { error_log( 'An error occurred while renaming the extracted file: '. - $outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '. + $outputDirectory.'/'.sprintf(self::OUTPUT_FILENAME, $format).' into: '. $outputFileName ); }