View Full Version : file handling
gusblake
03-27-2006, 11:25 PM
how do you append a file, but starting at the beginning?, so when you add to it the new stuff appears at the top?
Simply
03-28-2006, 01:08 AM
I think you will have to read the contents of the file then add your new info and rewrite the file.
$old_file = file_get_contents('somefile');
$new_file = $new_contents;
$new_file.= $old_file;
$fh = fopen('somefile', 'r+')
if (fwrite($fh, $new_file) === FALSE) {
echo "Cannot write to file ('somefile')";
exit;
}
fclose($fh);
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.