[56K WARN] display a word document in a textarea using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dream2rule
Forum Contributor
Posts: 109
Joined: Wed Jun 13, 2007 5:07 am

[56K WARN] display a word document in a textarea using PHP

Post by dream2rule »

Hello All,

I would like to know whether is it possible to display a word document in a textarea using PHP.

Regads
Styx
Forum Newbie
Posts: 9
Joined: Thu Jun 21, 2007 5:37 am

Post by Styx »

Try looking up how to use the COM class.
dream2rule
Forum Contributor
Posts: 109
Joined: Wed Jun 13, 2007 5:07 am

Post by dream2rule »

hie styx.. but i have no idea about COM classes..

Can't i do it using simple PHP without OOPS principles?
dream2rule
Forum Contributor
Posts: 109
Joined: Wed Jun 13, 2007 5:07 am

Post by dream2rule »

To be more specific...

Image

I am uploading a word file and storing it in a folder in the project directory.

Now, I have the path to the word file which was uploaded.

I am trying to open that file and reading its contents and displaying it in the textarea.

But in the textarea.. along with the file contents, even the properties of that word file are being displayed.

Image

I want to know is there anyway i can display only he contents of the word file in the textarea leaving aside the properties of the word file.

Thanks and Regards
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Unfortunately, Word documents are binary files, not simple text. You will have to parse them, whether you like it or not. I'd suggest switching to a more straight forward document format, be it XML, RTF, or plain text.
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

US link to COM class from above does not work, try this one instead:
http://www.php.net/manual/en/ref.com.php
dream2rule
Forum Contributor
Posts: 109
Joined: Wed Jun 13, 2007 5:07 am

Post by dream2rule »

feyd wrote:Unfortunately, Word documents are binary files, not simple text. You will have to parse them, whether you like it or not. I'd suggest switching to a more straight forward document format, be it XML, RTF, or plain text.
hie feyd..

But the point is.. i am uploading a resume of the user which is generally in a .doc format.

How do i get only the entire details of his resume but not the properties of the word document!

Regards,
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

dream2rule wrote:How do i get only the entire details of his resume but not the properties of the word document!
Basically you can't. While it's possible using the COM interface to MS Word the chance of that working on a live production server are close to zero. You'd have to put Word on the server. Writing a parser that works with every version of the .doc format would be years of work.

My advice... rethink. Why do you need to display the file contents in a text area? What are you doing with the content?

Also, somewhat off topic, if you're in the UK your form there is going to be breaking the law. Asking someone how much experience they have violates the new Employment Equality (Age) Regulations 2006 act.
Post Reply