Hi
I know this question is rather HTTP related than PHP, but I did not find an
HTTP group on my news server.
I deliver some files with the following PHP syntax:
header('Content-Description: File Transfer');
header('Content-Type: '.$mimetype);
header('Content-Length: '.filesize($fil e));
header('Content-Disposition: attachment; filename='.$fil ename);
readfile($file) ;
That works well with file types that need to be downloaded to disk. Anyway
if the file is a MP3 file, both IE and Mozilla do the same, they prompt me
to decide if I want to save it to disk, and then download the file entirely
before opening a player.
I sniffed for the differences in headers when a normal link to an mp3 file
is clicked and both tested UAs start streaming and playing immediately:
There is no Content-Disposition header. Removing this header, or just the
"attachment " part of it, results in the expected streaming behaviour, but
the filename is lost, and the script's filename is used instead.
Is it possible to serve the filename without a Content-Disposition header?
Or is there an alternative to the value "attachment ", which still allows me
to deliver a filename?
Thanks for a hint
Markus
I know this question is rather HTTP related than PHP, but I did not find an
HTTP group on my news server.
I deliver some files with the following PHP syntax:
header('Content-Description: File Transfer');
header('Content-Type: '.$mimetype);
header('Content-Length: '.filesize($fil e));
header('Content-Disposition: attachment; filename='.$fil ename);
readfile($file) ;
That works well with file types that need to be downloaded to disk. Anyway
if the file is a MP3 file, both IE and Mozilla do the same, they prompt me
to decide if I want to save it to disk, and then download the file entirely
before opening a player.
I sniffed for the differences in headers when a normal link to an mp3 file
is clicked and both tested UAs start streaming and playing immediately:
There is no Content-Disposition header. Removing this header, or just the
"attachment " part of it, results in the expected streaming behaviour, but
the filename is lost, and the script's filename is used instead.
Is it possible to serve the filename without a Content-Disposition header?
Or is there an alternative to the value "attachment ", which still allows me
to deliver a filename?
Thanks for a hint
Markus
Comment