Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Downloading a file from a link

Options
  • 23-08-2006 12:03pm
    #1
    Registered Users Posts: 1,305 ✭✭✭


    i know this is probably p1ss easy to do but i'm having one of those days so bare with me!

    on my page i have a link to an excel file. when i click the link it opens the file in the browser window but what i want it to do is just save the file when the link is clicked!

    i cant for the life of me get this to work! any ideas??!?


Comments

  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    A stabdard href like should bring the open / save dialog


  • Moderators, Politics Moderators Posts: 39,812 Mod ✭✭✭✭Seth Brundle


    Isn't it browser/system dependant also.
    With FF it tries to save/open but with MSIE it opens automatically for me.


  • Registered Users Posts: 1,305 ✭✭✭jobonar


    Smoggy wrote:
    A stabdard href like should bring the open / save dialog

    i'm using this code:
    <A href="Stats.xsl" target="blank">Save File</A>
    

    this just opens up the excel sheet in teh browser window but i want the user just to be prompted to save it.

    i'm using IE.


  • Moderators, Politics Moderators Posts: 39,812 Mod ✭✭✭✭Seth Brundle


    You can't fully control the users browsers actions (thankfully).
    As I said MSIE here opens word, PPT, XLS files within the browser. My copy of Firefox will open PDF files within the browser, etc.
    If you want the user to be given the opportunity to open.save the file then maybe zip it.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    The user could right-click the link and choose "save target as" or after the window is open (in IE) they could select File -> Save As and save the file to wherever they want... nothing to it really.


  • Advertisement
  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    A tiny extract from my conf/mime.types I have:
    application/vnd.ms-excel	xls
    application/octet-stream	bin dms lha lzh exe class so dll dmg
    
    If you move the xls extension to the octet-stream line it should force the Excel file to be downloaded by all browsers, because none of them will know a good way to to handle the application/octet-stream type.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    There are definitely ways to prompt the download dialogue. Here's how to do it with ASP for what it's worth


  • Registered Users Posts: 1,305 ✭✭✭jobonar


    daymobrew wrote:
    A tiny extract from my conf/mime.types I have:
    application/vnd.ms-excel	xls
    application/octet-stream	bin dms lha lzh exe class so dll dmg
    
    If you move the xls extension to the octet-stream line it should force the Excel file to be downloaded by all browsers, because none of them will know a good way to to handle the application/octet-stream type.

    this done the trick! thanks


Advertisement