Filename is the name of the file when it's downloaded.

So try something like:

<?php

$file = 'directory/test.mp3';

header("Content-Type: mp3");
header('Content-disposition: attachment; filename="test.mp3"');
echo file_get_contents($file);

?>



Kind regards,
Keri Henare
---------------------------------------------------
Chief Technical Officer
Pixel Fusion

[e]  [email protected]
[w]  pixelfusion.co.nz
[m]  (+64) 021 874 552
[p]  (+64) 09 550 3084

Zend Certified Engineer - 
http://www.zend.com/en/yellow-pages#show-ClientCandidateID=ZEND013450

PLEASE NOTE: I check my email 3 times per day and will respond at these 
intervals.  For anything urgent please ring me.
---------------------------------------------------

On 10/12/2010, at 1:58 PM, Nick Taylor wrote:

> Hello folks. Minor problemette
> 
> 
> When I run this
> 
> <?php
> 
> $file='directory/test.mp3';
> 
> header("Content-Type: mp3");
> header('Content-disposition: attachment; filename="'.$file.'"');
> 
> ?>
> 
> 
> it tries to access
> 
> directory_test.mp3
> 
> 
> which isn't there. I've tried various urlencodings etc - to no avail.
> 
> 
> Any idea what to do about this?
> 
> 
> 
> 
> 
> Nick
> 
> -- 
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to