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:
  text box  Archive Import (giny) at 10:40 on Wednesday, July 23, 2003
 

How can I save the text from a text box in to a *.txt file??

  Re: text box  Archive Import (Shrini) at 16:17 on Wednesday, July 23, 2003
 

It is simple...

<textarea name="textbox>Bla! Bla! Bla!</textarea>

Just in the next ASP page, receive the info... using the following....
<%
strTextBox = Request.Form("textbox")


SET tfile = fs.CreateTextFile(path\filename)
tfile.WriteLine strTextBox
tfile.close
Set tfile = nothing
%>

path can be full physical path or virtual path if you are using server.mapath

  Re: text box  Archive Import (Chung) at 17:14 on Monday, August 25, 2003
 

I think this code can only save the text to the server but what if I want to save this to my pc?

  Re: text box  Troy Wolf at 17:46 on Monday, August 25, 2003
 

Shrini`s example code is missing the object declaration line:

Set fs = Server.CreateObject("Scripting.FileSystemObject")

Then at the end of your code, it is a good idea to destroy the object:

set fs = Nothing

If you want to script against the filesystem object on the client, you can do this with VBScript but it is IE only. Also, a browser modifying the client`s filesystem is considered a big security risk. No default browser will allow this activity without warning the user and requiring them to authorize the activity. (Cookies are an exception -- these are usually allowed by default browsers.)

When this question has come up in the past, the answer seems to be, submit the text to the server, create a file on the server, then pass that file back to the client for download. This allows them to save it where they want and doesn`t pose a hidden security risk.
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: text box  Elain at 08:05 on Tuesday, November 23, 2010
 

I asked my friend about your question, I hope it can help you:)

<textarea name="textbox>Bla! Bla! Bla!








CodeToad Experts

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








Recent Forum Threads
•  For better, faster search use Lucidworks Advanced Query Parser
•  Re: Slide-In Button
•  Re: data type decimal
•  Re: maximum and minimum of two time
•  Re: Zoom script
•  Re: ticker script
•  Re: import contacts of msn/yahoo
•  Re: javascript , php echo, php include
•  Re: Write text strings to Serial Port


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