dear friends,
there is a one problem which i faced here.
i want copy one file from another then update copied file and finally changed file is overwrite on the original file.
but when i want to open copied file original file is opened .
what can i do?
code is as follows
if(!empty($files))
{
if(!is_dir("temp"))
{
mkdir("temp",0777);
}
if (!copy($files, 'temp/'.$files)) {
print ("failed to copy $file...<br>\n");
}
$tempdir = openDir( "temp" );
while( $tempfile = readDir( $tempdir ) )
{
print realpath($tempfile);
print"<br>";
print realpath($files);
print "<br>";
if ($tempfile==$files)
{
break;
}
}
//unlink($files);
//chmod($files,0777) or die("access denied");
$fp = fopen ($tempfile, "r") or die("file is not open ");
$len= filesize($tempfile);
$op=fread($fp,filesize($tempfile)) ;
if (eregi ("<title>(.*)</title>", $op, $out) )
{
$title = $out[1];
}
$op=eregi_replace($title,"ravindra ghetia",$op);
fputs($fp,$op);
:mad: