+ /**
+ * Build a Content-Disposition header value per RFC 6266
+ *
+ * @param $type string One of (attachment, inline)
+ * @param $filename string Suggested file name (should not contain slashes)
+ * @return string
+ */
+ final public static function makeContentDisposition( $type, $filename ) {
+ $type = strtolower( $type );
+ $type = in_array( $type, array( 'inline', 'attachment' ) ) ? $type : 'inline';
+ return "$type; filename*=UTF-8''" . rawurlencode( basename( $filename ) );
+ }
+