View Full Version : Saving a text area to a file.
07-24-2003, 08:31 AM
Hi anyone who reads this
Ive done some searching on the net but have been unsuccesful in possibly finding a way to save the contents of a Text Area or even a Text Field to a file onto my machine or the users machine.
Does anyone know how to do this ? is it possible ?
surely it is huh :) -> :confused:
07-24-2003, 08:51 AM
07-24-2003, 09:08 AM
07-25-2003, 07:39 PM
a text file to the clients machine, but it had problems.
I have since started writing a file on the server side
and using a link to the filename so when the user
clicks on it, it downloads like any other file.
Using the Active-X required too much tweaking of
the security settings than I wanted.
I don't have the coding anymore on what I used
to write to the file.
And, of course, the file is not saved on the computer where you are using the script from - not on the server who hostes this file.
<title>Saving textarea to file - www.united-scripts.com</title>
set fs = Createobject("Scripting.FileSystemObject")
file_location = "c:\textarea.txt"
set file = fs.CreateTextFile(file_location, True)
document.getElementById("result").value = "File successfully saved in " & file_location
var file_location = "c:/textarea.txt";
var fs = new ActiveXObject("Scripting.FileSystemObject");
file = fs.CreateTextFile(file_location, true);
document.getElementById("result").value = "File successfully saved in " + file_location;
<textarea cols="40" rows="10" id="text" style="width:400px;"></textarea><br>
<input type="button" onclick="save_text_vbs()" value="Save using VBScript (only in IE)" style="width:400px;"><br>
<input type="text" id="result" style="width:400px;border: 0px solid white;">
(This will only work if your scuritiy settings are permitting creating ActiveX Objects by Brwoser Scripting)
07-28-2003, 03:46 PM
yes, those were the links to the vbcode/active x
I was using.
The problem I encountered, was when the file
existed already. Sometimes the file would
get overwritten, other times the existing data
wouldn't get overwritten. It was inconsistant.
That may be OS dependent, or maybe it was
problem that may have been corrected in later
Unless this is on an intranet, with all the potential
security issues with activeX and websites, as stated
it's almost not worth the use.
But, it did work, and wasn't hard to implement.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.