Okay
  Public Ticket #1992885
Force MP3 Download?
Closed

Comments

  • Bill Steffey started the conversation

    Hi there!

    I have a general question. I want to put a simple link to let users download an mp3. Naturally, most browsers will just open up and play the file. I Googled a bit, and learned that adding download="filename.mp3" or download="true" to the <a> tag would do it, but no matter what I put, the browser still opens up the mp3 and plays it. I know WP also has some options during a media insert (Link to Media File, Link to Attachment Page) but I can't get anything to just force the download. Do you know any tricks to force a download of an mp3?

    Thanks much and looking forward to your thoughts!

    -Bill

  •  667
    Alexandre replied

    Hello Bill,

    A "Download" attribute in <a> tag should work. No value is required.
    May I see where have you done it?

    Other way is to use a zip file rather than a mp3 file.

    Thanks,


    Alexandre from the Sonaar.io Crew

  • Bill Steffey replied

    https://williamsteffey.com/2019/04/29/ashland-remix/

    In source, this is what appears:

    <p>DOWNLOAD: <a href="http://williamsteffey.com/wp-content/uploads/2019/04/Ashland-cassette-remix.mp3" download="true">Ashland [cassette remix].mp3 (12.7 MB)</a></p>

    I can do a zip if necessary, but would love to know how to do the force download of the mp3 because it comes up a lot. Thanks!

  •  667
    Alexandre replied

    Hi Bill, 

    Your html is good. 
    Except the "true" value. The download value will rename the downloaded file. But anyway, your code should works. I think this is more about folder permission or server security. I m sorry I dont dont know how to help.

    Thanks,


    Alexandre from the Sonaar.io Crew

  • Bill Steffey replied

    Hi Alexandre,

    I decided to zip up the file instead. Now I have a different issue. The browser links to the zip file, but doesn't download. Additionally, it routes to a blank page with just the navigation on it. Is this still a permissions issue? Should I check with my host? Thanks much for your help on this one. (page is https://ademdalipi.com/thank-you/ )

    Bill

  •  667
    Alexandre replied

    I have added the class "no-ajax" to the button

    https://d.pr/free/i/qS6DDf

    Thanks,


    Alexandre from the Sonaar.io Crew