Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box to .txt file using ASP

Status
Not open for further replies.

nkrst1

Programmer
Feb 13, 2001
49
US
In a form, how do you save the contents of a text box into a text file on the server? I basically want people to cut and paste a doc into the text box, hit send, and then have that text box's information saved in a .txt file on the server along with an ID in the .txt's file name. I have all the ID's created when the form is sent, I just need a method of saving the text box.

Any help will be much appreciated.


-n-
 
nkrst1,

I don't have time to explain it today, but what you need to look at is the FileSystemObject. From this you can create a textfile and write to it as you want to.

The FileSystemObject will allow you to get into a directory, and create the file in the specified directory. Then you can use the textstream (I think that's what it's called) to write to the file.

Sorry I couldn't show you any code at the moment.

Mike
 
the following makes textfile and adds aa line

<%
dim formtxtbx
formtxtbox=request.form(&quot;txtbox&quot;)
Dim filesys, txtfile
set filesys = createobject(&quot;scripting.FilesystemObject&quot;)
set txtfile = filesys.createtxtfile(&quot;c:/ blah blah.txt&quot;)
txtfile.Writeline(&quot;&quot; & formtxtbox % &quot;&quot;)
Txtfile.close
%>


the following opens a file and ads a line

<%
dim formtxtbx
formtxtbox=request.form(&quot;txtbox&quot;)
Dim filesys, txtfile
set filesys = createobject(&quot;scripting.FilesystemObject&quot;)
set txtfile = filesys.opentextfile(&quot;c:/ blah blah.txt&quot;,8,0)
txtfile.Writeline(&quot;&quot; & formtxtbox % &quot;&quot;)
Txtfile.close
%>

hope that helps
 
Thanks so much! This is exactly what I need.


-n-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top