PHP allows file uploads, file write, copy, move, delete and also it supports conversion of one file format to another.
In this example we will see how a doc file is converted to a text file.
In this example we will see how a doc file is converted to a text file.
function doc2text($file)
{
$file = $directory.'/'.$filename;
$fileinfo = pathinfo($filename);
$content = "";
// doc to text
$content = shell_exec("antiword -m UTF-8.txt -t $file");
return $content;
}
The usage of the function is as follows:
$file = "documents/files/doc/test.doc";
doc2text($file);
No comments:
Post a Comment