* See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * Pierre-Gildas MILLON <*****@*****.**> */ require_once '../vendor/autoload.php'; $client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator'); if (!empty($_POST['path'])) { $path = $_POST['path']; try { /** @var \Nuxeo\Client\Api\Objects\Blob $blob */ $blob = $client->automation('Blob.Get')->input('doc:' . $path)->execute(\Nuxeo\Client\Api\Objects\Blob::className); $response = new \Symfony\Component\HttpFoundation\BinaryFileResponse($blob->getFile()); $response->setContentDisposition(\Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_ATTACHMENT, $blob->getFilename()); $response->prepare(\Symfony\Component\HttpFoundation\Request::createFromGlobals())->send(); } catch (\Nuxeo\Client\Internals\Spi\NuxeoClientException $ex) { throw new RuntimeException(sprintf('Could not fetch blob of %s: ', $path) . $ex->getMessage()); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>B5 test php Client</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme -->