从MySQL数据库下载文件

时间:2011-05-01 12:56:35

标签: php mysql

  

可能重复:
  Uploading an audio recording to mysql and playing in website

我有.mp3存储在MySQL数据库中,我想知道是否有任何PHP代码,以便用户可以访问我的网站并下载文件在那里的电脑上播放

答案

  $test2 = @mysql_query("select * from media_link where instance_id = $id");
    $result2 = mysql_fetch_array($test2);

    $media = $result2['media_id'];

header('Content-Type: audio/amr');
header('Content-Disposition: attachment; filename="test.mp3"');
echo $fileContents;

0 个答案:

没有答案