Jump to content

Reading a File Using fread


avahaf

Recommended Posts

I would like to know what are the files (.txt,.jpeg,.png) we can read using only with fread function.I know there are some other in build functions there to read .xls,.xml & .csv files.Recently I have an issue to read a .doc or .docx file using fread. finally I modified that file into .txt file and read the same.Please need a solution.

Link to comment
Share on other sites

You can read any file, the problem is how to interpret what is being read. Doc and docx file store all kinds of formatting data along with the text that's written, so you can't just read plain text from the file. Actually interpretting docx files on the server is really difficult, you would need a program with the complexity of Microsoft Word to read and manipulate docx data.

Link to comment
Share on other sites

There are PHP classes for reading Office documents if you want to do that. Files are either text or binary though, but you can read all of them. It might not make sense to read the binary data of a file, but PHP won't stop you from doing it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...