views:

247

answers:

3

Pls suggest me any inbuilt command or package?

A: 

Try this:

$data = fopen('myfile.png', 'rb'); // read in binary mode.

if ($data) {
  header('Content-Type: image/png');
  fpassthru($data);
}

You should change content-type accordingly.

Sarfraz
+1  A: 

well, it shouldn't be too hard to find something from the net. Here's one for Python called pyPDF. Check PyPi also for such modules. As for reading doc,ppt,xls files, one way is to use COM.

ghostdog74
+1  A: 

The content as in "binary" or the actual text?

To read the file as "binary" in php: http://php.net/manual/en/function.file.php

In python: http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files

Actually reading the contents of the file is a lot more difficult and requires additonall libraries. For instance have a look at this question on SO (Python): http://stackoverflow.com/questions/685533/python-convert-microsoft-office-docs-to-plain-text-on-linux

Jasper