Jump to content

Downloading mp3's


jane_prg

Recommended Posts

Hello.How are You?

 

  I'm wondering about how to setup an mp3 for downloading from my server using php.

Should I use something like a filesystem object to convert the data to byte data?

I'm at a bit of a loss right now.A tutorial would be helpfull.

                           

                        Thank you

Link to comment
https://forums.phpfreaks.com/topic/47441-downloading-mp3s/
Share on other sites

 

Thanks for the reply.

  I ran this code on an apache server on my machine and it downloaded just fine.

    The thing is I got a "page can't be displayed error "when I tried to download from a real webserver.It didn't work at all.I'm wondering,perhaps I don't have permission to download.I don't know what the problem is.Any suggestions?

 

    Any help at all would be appreciated.

 

<?php

header("content-type:application/octet-stream");

header('content-Disposition:attachment;filename="Dark night.mp3"');

readfile('YourSmile.mp3');

?>

Link to comment
https://forums.phpfreaks.com/topic/47441-downloading-mp3s/#findComment-233765
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.