Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   ASP.NET form action file - writing to text file (http://www.velocityreviews.com/forums/t728123-asp-net-form-action-file-writing-to-text-file.html)

icedragon 07-13-2010 01:48 PM

ASP.NET form action file - writing to text file
 
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


All times are GMT. The time now is 10:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.