You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
richdocuments/lib/download/simple.php

33 lines
818 B
PHP

<?php
namespace OCA\Office\Download;
use OCA\Office\View;
class Simple extends \OCA\Office\Download {
public function __construct($filepath){
$this->filepath = $filepath;
}
public function sendResponse(){
$this->view = View::initOfficeView(\OCP\User::getUser());
header( 'Content-Type:' . $this->getMimeType() );
$encodedName = rawurlencode($this->getFilename());
if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])){
header(
'Content-Disposition: attachment; filepath="' . $encodedName . '"'
);
} else {
header('Content-Disposition: attachment; filepath*=UTF-8\'\'' . $encodedName
. '; filepath="' . $encodedName . '"');
}
header('Content-Length: ' . $this->view->filesize($this->filepath));
\OC_Util::obEnd();
$this->view->readfile($this->filepath);
}
}