forked from TIU11/Basic-CMIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstream.php
25 lines (19 loc) · 811 Bytes
/
stream.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
add_action('plugins_loaded', 'cmis_download');
function cmis_download() {
$cmis_object_id = $_GET['cmis_obj_id'];
if($cmis_object_id != '')
{
$client = new CMISService(get_option('cmis_repository_url'), get_option('cmis_username'), get_option('cmis_password'));
$props = $client->getProperties($cmis_object_id);
$file_name = $props->properties['cmis:name'];
$file_size = $props->properties['cmis:contentStreamLength'];
$mime_type = $props->properties['cmis:contentStreamMimeType'];
header('Content-type: $mime_type');
header('Content-Disposition: attachment; filename="'.$file_name.'"');
header("Content-length: $file_size");
$content = $client->getContentStream($cmis_object_id);
echo $content;
}
}
?>