Jump to content

Reading a File Using fread


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...