Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading word doc and inserting text into database

Status
Not open for further replies.

greymonkey

Technical User
Jul 20, 2003
29
0
0
AU
Hi All,

I need to read the text from an uploaded text document and input this into a field on my sql server.

I have to code:
$story_text = file_get_contents($upfile);

which read the document ok but it also includes all of the strange asci codes.

Any Suggestions?
Thanks,
 
On what OS are you running PHP?

There is no PHP-internal function for stripping the text out of a Word document. You'll have to invoke external programs or libraries to do this.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 

These PHP functions seem will grab text out of the document fine:
fopen()
fread()
fright()
file_get_contents

the problem is that they also get all the other characters the doc files have in for the formating.
Any ideas for filtering them out.

The other option I was looking at is if you use file_get_contents from a HTML file it will only grab the text and leave the html code.
If any one has any idea how to convert a word document file into an HTML file during the upload stage that would help.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top