setting up text file downloads


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: setting up text file downloads

  1. #1
    sean Guest

    setting up text file downloads


    I'm working on a web-based application that allows the users to save data
    sets as a text file on the server. Once they generate the file, they are
    given a link to download it. The link is just a simple anchor tag, <A HREF="extract.txt">Download</A>.
    Problem is, when the link is fired the text file loads in the browser window.


    Is there some way to access the browser funtion you get when you right-click
    on a link that lets save the target as a file? Besides giving the file some
    fake extension to force the browser to ask users what they want to do with
    the file? Thanks, Sean

  2. #2
    Andrew Guest

    Re: setting up text file downloads


    I've been trying to do something similar and have a partial answer to your
    question. If your using VbScript and ASP then try something like this:

    <%
    Response.contentType = "Application/save"
    Response.AddHeader "Content-Disposition", "filename=filename.txt;"

    Response.Write "the text you want in the file"
    %>

    This seems to have some problems but should give you a good starting point
    to jump from. When this script is run it should promt the user to download
    "filename.txt". Like I said I have had some problems with this myself, but
    give it a shot.


    "sean" <sean_witte@hotmail.com> wrote:
    >
    >I'm working on a web-based application that allows the users to save data
    >sets as a text file on the server. Once they generate the file, they are
    >given a link to download it. The link is just a simple anchor tag, <A HREF="extract.txt">Download</A>.
    >Problem is, when the link is fired the text file loads in the browser window.
    >
    >
    >Is there some way to access the browser funtion you get when you right-click
    >on a link that lets save the target as a file? Besides giving the file some
    >fake extension to force the browser to ask users what they want to do with
    >the file? Thanks, Sean



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center