-
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
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks