|
How can I save the text from a text box in to a *.txt file??
|
|
|
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
|
|
|
I think this code can only save the text to the server but what if I want to save this to my pc?
|
|
|
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.
|
|
|
|
|
I asked my friend about your question, I hope it can help you:)
<textarea name="textbox>Bla! Bla! Bla!
|
|
|
|
|
|
|
|