ASP.NET form action file - writing to text file

Joined
Jul 13, 2010
Messages
1
Reaction score
0
Hey guys,

So I'm trying to write a javascript array to a server-side text file. I've got my form:

Code:
<form id="my_form" action="">  
<input type="text" id="file_name" rows="1" cols="20">  
<a href="javascript: submitform()">Save</a>  
</form>

And the javascript code:

Code:
function submitform();  
{  
var d = seatsArray.join();  
var url = "mysite/savetext.asp?seatsArray="+d + "&file_name=" +   
document.getElementById("file_name").value;  
  
document.getElementById("my_form").action = url;  
document.getElementById("my_form").method = "POST";  
document.getElementById("my_form").submit();  
}

And I'm not sure about how I can make an action file in ASP.NET for this form so that it will write the contents of this array (a separate line for each value) into a text file. It also needs to create the text file and name it what the user put in the "file_name" text box. I tried something briefly but it is incomplete:

Code:
<%  
Dim objFSO, objTStream  
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")  
Set objTStream = objFSO.CreateTextFile("THIS NEEDS TO BE WHAT THE USER ENTERED IN 'FILE_NAME'", True)  
objTStream.WriteLine("THIS NEEDS TO BE THE ARRAY")  
objTStream.Close  
Set objTStream = nothing  
Set objFSO = nothing  
%>

Can you help me out with how to make this work?

Thanks!

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top