eneyas Posted September 4, 2007 Share Posted September 4, 2007 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: <?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! Quote Link to comment https://forums.phpfreaks.com/topic/67906-can-i-declare-content-size/ Share on other sites More sharing options...
cooldude832 Posted September 4, 2007 Share Posted September 4, 2007 try using $fsize = filesize($mp3_location); then declare that as a header i.e header('content-size: $fsize'); Quote Link to comment https://forums.phpfreaks.com/topic/67906-can-i-declare-content-size/#findComment-341331 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.