Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

download, don't open

  • 08-06-2006 03:09PM
    #1
    Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭


    I need a link that forces the 'save as' dialog for a file which would usually load in the browser window. Anyone know how this is done?


Comments

  • Closed Accounts Posts: 6,113 ✭✭✭subway


    seems do able with asp
    not with html

    have a read of this,
    lots of guides on google too

    http://www.aspfaq.com/show.asp?id=2161


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    Cheers, though I should have specified I'd much prefer something in PHP.

    I think the PHP header function might do the trick.


  • Closed Accounts Posts: 6,113 ✭✭✭subway


    found this to,
    might make sense to you as you php -

    <?php
    header("Content-type: application/x-unknown");
    header("Content-Disposition: attachment;
    filename=proposedFileName.wav");
    readfile('test.wav');
    ?>


    "Content-type: application/x-unknown seems to be the imporatan but as it tells the browser that even though it recognises the extension, it doesnt know what to do with it


  • Closed Accounts Posts: 7,562 ✭✭✭leeroybrown


    As pointed out it's not possibly using HTML alone but it realatively easy to script a streamed download that will use header functions with 'Content-Type' and 'Content-Disposition'.

    If you are dealing with a particularly large file be careful how you implement it as there can be a large memory overhead (and a delay) in providing streamed downloads where the entire file is read in first and then streamed out.


  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    there was a thread on this in the programming forum a while back.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 597 ✭✭✭yeraulone


    zip it.


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    yeraulone wrote:
    zip it.
    Not really on option I'm afraid.
    If you are dealing with a particularly large file be careful how you implement it as there can be a large memory overhead (and a delay) in providing streamed downloads where the entire file is read in first and then streamed out.
    Hmm.. I've got potentially quite big files alright :-/

    Cheers for all the replys anway.. should be able to sort something out.


Advertisement