wcbennett3 Posted November 14, 2013 Share Posted November 14, 2013 I am managing a site that has .mp3 files (recordings of talks made in-house) available for streaming. I need to create a way for users to download .mp3s directly, but when they click the link, the audio automatically plays rather than downloads. The link to the file is currently reading another php file, and is set up as follows: <a href="<?php echo get_field('talk_info_talk_audio') ?>">Download the audio</a> Any help is appreciated. ~wb Quote Link to comment Share on other sites More sharing options...
gristoi Posted November 14, 2013 Share Posted November 14, 2013 you need to make sure the php that is setting up the mp3 is also setting up the right headers, so that the browser knows what to do with the resource: eg: header ("Content-type: octet/stream"); header ("Content-disposition: attachment; filename=something.mp3;"); header("Content-Length: ".filesize(<size of the file>)); Quote Link to comment 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.