Anyone have a working example of a PHP script to create a text file using
PHP?
I am trying to get the following to work but it is not creating the text
file on my server. I have set the permissions of the folder to 777 which
should in theory allow a file to be created.
Thanks
Paul
<?php
// the name of the text file
$filename = 'test3.txt';
// hard code the variable from flash
$somecontent = "Add this to the file\n";
// If the file doesn't exist, attempt to create it
// and open it for writing
// anything already writen will be replaced
if (!$handle = fopen($filename, 'w')) {
echo "&message=Cannot open file&";
exit;
}
// Write $somecontent to the opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "&message=Cannot write to file&";
exit;
}
// close the file
fclose($handle);
// send the variable to flash
echo "&message=$somecontent&";
?>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com