Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Mar 2003
    Location
    Heredia. COsta Rica
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use .haccess to force download music

    I place an .haccess file in my mp3 directory in my web in order to force visitors browsers to download linked mp3 files as I wrote in www.javascriptkit.com.

    They say "to force a file to be downloaded, via the save as browser featue, you simply set a MINE type to application/octet-stream and tha immediately prompts you for the download".

    The .htaccess file I do understood I do have to place in my mp3 directory is just:
    AddType application/actet-stream mp3

    I try but it doesn't work. Why?

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts

    Re: Use .haccess to force download music

    Originally posted by jfari

    AddType application/actet-stream mp3
    Spelling, maybe? application/octet-stream

    Also beware that iew doen't always obey mime-types and run the file instead of download.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New Coder
    Join Date
    Mar 2003
    Location
    Somewhere far beyond
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    He... You just misunderstood what they said.
    It means that when you'll click on link with target set to something like /dir_where_such_htpasswd_resides/your_file.mp3
    you'll see "Save as..." dialog box
    WBR, Weirdan.

  • #4
    New to the CF scene
    Join Date
    Mar 2003
    Location
    Heredia. COsta Rica
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, I wrote wrong on this forum, NOT IN THE .htaccess file:

    AddType application/octet-stream mp3

    This is the only line I wrote on the .htaccess file placed in my mp3 folder.

    As I do understood, it may force mp3's files placed in this folder to open the download dialog box on browsers than chick on their links, instead of be played from the web.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'd do it with PHP - like this thread
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    New to the CF scene
    Join Date
    Mar 2003
    Location
    Heredia. COsta Rica
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I try with .php file, but I recieve an INTERNAL ERROR from the server.

    I upload a download.php file like this:

    <html>
    <head>
    <title>Gestor de Descargas</title>
    </head>

    <body>
    <?php
    $saveName = stripslashes($HTTP_GET_VARS["name"]);

    $savePath = stripslashes($HTTP_GET_VARS["path"]);

    header ("Content-Type: application/octet-stream");

    header ("Content-Disposition: attachment; filename=$saveName");

    header ("Content-Transfer-Encoding: binary");

    readfile($savePath);

    ?>
    </body>
    </html>

    And I point the download.php in my HTML page for download with this link:

    <a title="MP3 download" href="/download.php/?path=mp3/cpr_ln.mp3&name=cpr_ln.mp3">MP3</A>

    Permision cmod to 744. And I recieve this message:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@rootslatino.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.



    After two days trying I AM LOST. Any idea to help me?

  • #7
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Which browser are you trying this with? You may want to read this entry in the WDG FAQ:
    http://htmlhelp.com/faq/html/media.html#force-download
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #8
    New to the CF scene
    Join Date
    Mar 2003
    Location
    Heredia. COsta Rica
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. ¡Great link! But I still can not solve my problem.

    What about to place a CGi? Should any CGI force download?

  • #9
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Zip it up.
    Can't say for sure but I've never heard that can be done in a reliable way.
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •