codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Writing a value to a text file  Archive Import (packermann) at 18:54 on Tuesday, June 24, 2003
 

I need to have the user click on a link, File Save As dialog box pops up, user then saves the contents of a variable into memory. Please help.

  Re: Writing a value to a text file  Troy Wolf at 16:11 on Wednesday, July 16, 2003
 

Off the top of my head, here are my thoughts.

One way is to use client-side VBScript and use the filesystem object to create a file and write the variable contents into the file. This is actually pretty easy to do. However, most people`s computers will be configured to block that kind of activity. (Imagine any generic website being allowed to write any kind of files to your hard drive!) If the application is only run by a controlled user base, then you may get away with it by having them specifically set your site to a Trusted site and allow script processing.

A second way would be to have the page submit back to an ASP script on your server that saves the variable contents into a text file on your server, then serve that file back to the user via an HTML page with a link to download it. (You`ll need to add a note to tell your users to right-click and choose Save As. Otherwise, the browser will just open the text file.) Unless--you want to get fancier and force the page as a file stream--which can be done.

Either way, I think you`ll end up needing to send the variable contents back to your server, create a file there, then send that file to the client. Maybe someone will reply with a better method.
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  parent.Resize() in multi tabbed IE window
•  Re: How to Remove the URL`s from printouts
•  Re: 2 or more scripts
•  Re: query can we
•  Re: Disbale edit
•  Re: How to get all the properties values of an object
•  Re: Catalog
•  Re: DHTML drop down menu
•  Re: Where do I find source code on this site?


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010