how to put an html file for download?

Results 1 to 3 of 3

Thread: how to put an html file for download?

  1. #1
    K.Nagalinga Reddy Guest

    Default how to put an html file for download?

    Hi guyz,<BR> I wanna put an html file for download to the users. For example,<BR> <BR> &#060;a href="taxreturns.html"&#062;click here to the file&#060;/a&#062;<BR><BR> In the above code, If the user click on the link shown, then the html file given(taxreturns.html) is directly opened in the browser. But, it I want that file to be put for download rather than opening it directly. I mean, the browser should ask the user to whether open the file or save it. How to do this? Hope You guyz got my poing. So, Plz help me regarding this. Thankz in advance. Bye....with Regards, Nag!

  2. #2
    Join Date
    Dec 1969

    Default RE: how to put an html file for download?

    You&#039;re not going to be able to HREF a file that the browser can interpret and get it to prompt the user. For example, all browsers will load an html file, most will load a .txt file, etc. If you want your users to save an html file to their harddisk, you could simply put instructions for the user to save it... i.e. (FILE&#062;SAVE AS). Other than a user manually saving the html file, there is no other simple way to do it. I suppose it could be done with enough java code, but that is not my department.

  3. #3
    Join Date
    Dec 1969

    Default RE: how to force an html file to download?

    Perhaps check out the following which works (hopefully) if the initial page is an .asp page:<BR><BR>Force "file download" for known file types<BR><BR>"Suppose you have written an ASP page that contains a link to a known MIME type, but you want the user to download the file instead of viewing it. Add the following to your script:<BR> response.addHeader "content-disposition", "attachment;filename=filename.ext"<BR>Then substitute the actual filename and extension, and it is as good as done. When your users click on the link, they will immediately see the download dialog box instead of the files contents.<BR><BR>HOWTO: Raise a "File Download" Dialog Box for a Known MIME Type<BR><BR>Response.AddHeader "content-disposition","attachment; filename=fname.ext" <BR><BR>Best regards,<BR>-Paul<BR><BR> - Web Database Developer<BR><BR>Developer Quick Tips Page<BR><BR>

Posting Permissions

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