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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.