php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37135 header(Content-Type: mime_type) must have a leading before the mime_type
Submitted: 2006-04-19 10:39 UTC Modified: 2006-04-20 06:08 UTC
From: nbari at mac dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.1.2 OS: Mac OS X version 10.4.6
Private report: No CVE-ID: None
 [2006-04-19 10:39 UTC] nbari at mac dot com
Description:
------------
a leading slash must be used on the mime_tye to get Content-
Type to work:

header("Content-Type: audio/x-ms-wma"); do not work

header("Content-Type: /audio/x-ms-wma"); it works

Reproduce code:
---------------
<?php
header("Content-Type: audio/x-ms-wma"); 
header("Content-Disposition: filename=\"file.wma\"");   
readfile("/Volumes/RamDisk/file.wma"); 
?>

if audio/x-ms-wma is replaced with /audio/x-ms-wma so it looks like :
header("Content-Type: /audio/x-ms-wma"); 

the code works. 

with out the leading / the code do not work.



Expected result:
----------------
the windows media player to open the wma file or the option 
for saving the file.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-19 10:43 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2006-04-19 22:56 UTC] nbari at mac dot com
making some tests, notice that the code works on php 4 but 
the problem only seems to happend on php 5.1.2. i used the 
following code for testing:

<?php
$file = 'file.wma';
$tono = 'tono.wma';
$content_length = filesize($file);

header("Content-Type: audio/x-ms-wma"); 
header('Content-Length: '.$content_length);
header('Content-Disposition: filename="'.$tono.'"');
readfile($file);
?>
 [2006-04-20 06:08 UTC] nbari at mac dot com
Solution.

the problem was that for some reason the browser need the 
extension of the file so i solve this using the following on 
the virtual host:

RewriteRule ^/demo/(.+)/(.+)\.wma$ /demo.php?module=$1&id=$2 
[L]

that way the url can be something like /demo/test/file.wma 
and the file can be now download and played.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC