Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send ASCII delimited file for a browser to downlo
Message
General information
Forum:
Internet
Category:
Active Server Page
Miscellaneous
Thread ID:
00468740
Message ID:
00469012
Views:
14
OK. I give up. How do you paste HTML code in here? The help seems to
be unhelpful. Anyway, I reposted with the missing line, and added spaces
between the < %, % >, and < ! lines you'll need to remove.

If you want the browser to prompt for a download even if it already knows the MIME type, you can create a small ASP page with the following code. This sample will stream the file to the browser and will prompt the user with a default file name of your choice:

' -- PASTE INTO NEW .ASP PAGE
< %
Response.AddHeader "Content-Disposition", "attachment;filename=test.txt;portable-filename=test.txt"
Response.ContentType = "application/octet-stream"
% >
< !-- #INCLUDE FILE="test.txt" -->
' -- END


You can probably also add filesystemobject code to erase the file after the
last line since it will already have been streamed in the download. You can pass the temporary file name to the script page then delete it when done..


>Your second choice (file) sounds better. I thought that it had to do more with setting context type but I tried text/plain and a couple of others and couldn't get it to work.
>
>So I'll create a txt file, I guess with a weird extension so the browser does not attempt to show it but to download it instead. When should the temp file be deleted to make sure that they had enough time to download it (it's fairly short) and that it does not linger too long on the server for security purposes?
>
>Thanks Guy
>
>>>>>>>>>>>>>
>One way is to output with response.write without any HTML tags. The user can then choose File/Save As to save the file.
>You can also output to a temp file on the server and redirect to that file. You'll have to clean up at some point. If the file contains sensitive data, other users could have access to it before you delete the file.
>>>>>>>>>>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform