summaryrefslogtreecommitdiffstats
path: root/lib/private/response.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/response.php')
-rw-r--r--lib/private/response.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/response.php b/lib/private/response.php
index 674176d078b..04746437347 100644
--- a/lib/private/response.php
+++ b/lib/private/response.php
@@ -148,6 +148,20 @@ class OC_Response {
}
/**
+ * Sets the content disposition header (with possible workarounds)
+ * @param string $filename file name
+ * @param string $type disposition type, either 'attachment' or 'inline'
+ */
+ static public function setContentDispositionHeader( $filename, $type = 'attachment' ) {
+ if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME))) {
+ header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' );
+ } else {
+ header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename )
+ . '; filename="' . rawurlencode( $filename ) . '"' );
+ }
+ }
+
+ /**
* @brief Send file as response, checking and setting caching headers
* @param $filepath of file to send
*/