Jump to content

Can I declare Content-size?


eneyas

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/67906-can-i-declare-content-size/
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.