Need basic Cgi help to save a text file


So I volunteered to design a dynamic flash website without any real skills to further the ‘dynamic’ side of things. The flash I’ve got all figured out, but I need help building a basic cgi (I assume… better way?) page to save a text file to the server. IE, a textbox that the news can be typed in to with a button that submits it and saves it to whatever.txt to be accessed by the flash file.
I found a prebuilt one, but I couldn’t for the life of me make it work, even with the knowledge of dreamhost’s screwy cgi permissions. I’d like to just set this in a htaccess-ed directory so that the admin can simply use his password and update it.

Any suggestions?



For what you’re asking you’ll have to build the actionscript functionality into the flash movie itself. The flash movie will use the loadVariables functionality to access the static text document on the server, which can be updated via ftp with whatever frequency it changes.

You will only have to lean on server side scripting if ftp isn’t a viable option for you. Are you rendering strictly text language, or will it include formatting like html code? You can save text input from a form submission by using something similar to the following on a PHP action page.

$submittedtext = $_POST[“submittedtext”];
$filename = “/home/user/textdocs/textfile.txt”;

if (!$handle = fopen($filename, ‘w’)) {
print “Cannot open file ($filename)”;

if (!fwrite($handle, $submittedtext)) {
print “Cannot write to file ($filename)”;



Ah, simple php. If only I was better at searching help files…