can I declare Content-size?
Posted: Tue Sep 04, 2007 10:42 am
OK, I'm a total PHP newbie, so maybe this is a dumb question:
I started using a simple PHP file to force browsers to download mp3 files instead of playing them directly in the browser, or trying to instruct the user to right click and choose "save target as..."
it works fine, except i can't figure out a way to declare the size of the MP3. on slow connections, because the browser doesn't know how big the file is, sometimes it cuts it off early and people only get part of the file.
SO, my basic question is this: is there a way to declare the size of the MP3 file?
here is my code currently:
if you want to see what i'm talking about in action, go to: http://www.lakeshorevineyard.org and click on one of the "download" links.
help!
I started using a simple PHP file to force browsers to download mp3 files instead of playing them directly in the browser, or trying to instruct the user to right click and choose "save target as..."
it works fine, except i can't figure out a way to declare the size of the MP3. on slow connections, because the browser doesn't know how big the file is, sometimes it cuts it off early and people only get part of the file.
SO, my basic question is this: is there a way to declare the size of the MP3 file?
here is my code currently:
Code: Select all
<?php
header('Content-disposition: attachment; filename=070902_JH_Dwell7.mp3');
header('Content-type: audio/mpeg');
readfile('http://www.lakeshorevineyard.org/07audio/mp3/sm/070902_JH_Dwell7.mp3');
?>if you want to see what i'm talking about in action, go to: http://www.lakeshorevineyard.org and click on one of the "download" links.
help!