diff --git a/include/class.file.php b/include/class.file.php
index e61b5afe76516fcecfd880359bb6193c13164b4e..5bbd3d8859b1303648bc6464a9075040b8a1e3c9 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -258,7 +258,9 @@ class AttachmentFile extends VerySimpleModel {
         $type = $this->getType() ?: 'application/octet-stream';
         if (isset($_REQUEST['overridetype']))
             $type = $_REQUEST['overridetype'];
-        Http::download($name ?: $this->getName(), $type, null, 'inline');
+        elseif (!strcasecmp($disposition, 'attachment'))
+            $type = 'application/octet-stream';
+        Http::download($name ?: $this->getName(), $type, null, $disposition);
         header('Content-Length: '.$this->getSize());
         $this->sendData(false);
         exit();