[php]
<?php $file="sum.docx";(sum.docx file in www folder sum.docx contains add a and b) header("Content-Type:application/.docx"); header("Conent-Length" . filesize($file)); header("Content-Disposition:attachment";filename=sum.docx"); $content=file_get_contents($file); $string=str_replace("add","sub",$content); $fp=fopen($file,"w+"); fwrite($fp,$string); fclose($fp); echo file_get_contents($file); ?>[/php]
The str_replace function was worked for ".Txt: files.But for .docx files the string was not replaced.i.e the contents of the file were not changed after string replacement.