Jump to content

Download help?


frobak

Recommended Posts

Thsi file open a dialog box to open the index page and not the mp3 file.

 

ANy idea why this happen?

 

<?php

include '../functions/db_connect.inc.php';

 

$sql = ("INSERT INTO downloadcount

  (downloadid) VALUES

  ('$_REQUEST[downloadreq]')");

 

$result = @mysql_query($sql,$connection) or die(mysql_error());

 

$filename = "milli.mp3";

$myFile = "/httpdocs/djneils/mixes/milli.mp3";

 

$mm_type="application/octet-stream";

 

header("Cache-Control: public, must-revalidate");

header("Pragma: hack"); // WTF? oh well, it works...

header("Content-Type: " . $mm_type);

header("Content-Length: " .(string)(filesize($myFile)) );

header('Content-Disposition: attachment; filename="'.$filename.'"');

header("Content-Transfer-Encoding: binary\n");

 

readfile($myFile);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/127993-download-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.