fwrite() doesnt always work
Posted: Thu Jan 12, 2006 8:49 am
i am opening a file in a textarea and people can edit it and save it..
its work fine adding stuff to the file and saving it..
BUT if i delete stuff from the fiel and save it it doesnt do it!.. why?
cause the file size is smaller? less data in it??
heres the code i have written
$FilePath = $_POST['Path'];
$FileData = $_POST['filedata'];
$SortedData = stripslashes($FileData);
$FileName = $FilePath;
$FilePointer = fopen($FileName, "r+");
fwrite ($FilePointer, $SortedData);
fclose($FilePointer);
cheer all
its work fine adding stuff to the file and saving it..
BUT if i delete stuff from the fiel and save it it doesnt do it!.. why?
cause the file size is smaller? less data in it??
heres the code i have written
$FilePath = $_POST['Path'];
$FileData = $_POST['filedata'];
$SortedData = stripslashes($FileData);
$FileName = $FilePath;
$FilePointer = fopen($FileName, "r+");
fwrite ($FilePointer, $SortedData);
fclose($FilePointer);
cheer all