Jump to content

Recommended Posts

Hi guys,

 

On my site I use php header() functions to force downloading of .mp3 files to bypass Quicktime playing them in-browser -- the MP3 files aren't stored on my server. Now, if I just link to the MP3 and instruct them to "Save target as..." to download it, it takes none of my bandwidth, since it's on a different server, whereas if I use php header() inside of a get.php-type file to make it automatically popup a "save file" dialog, it hogs my server's bandwidth like crazy when people download! So php headers has to pipe the file through the server to the user?

 

Either way, I can't afford this bandwidth so will just a php readfile() funct. like

 

      readfile($song->url);

 

NOT take from my bandwidth, as opposed to;

 

      header("Content-Length: " . $song->content->length);

      header("Content-Type: " . $song->content->type);

      header("Content-Disposition: " . $song->content->disposition);

 

 

 

 

Thanks guys! This forum is very very helpful and the users are friendly.

 

 

David

Link to comment
https://forums.phpfreaks.com/topic/106243-php-header-vs-readfile-bandwidth/
Share on other sites

Either way, I can't afford this bandwidth so will just a php readfile() funct. like

 

       readfile($song->url);

 

That will use twice as much bandwith. First your server will download it from the remote server, then it will upload it to the client requesting it.

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.