How can I submit the txt and doc files to textarea?

Source: Internet
Author: User
How can I submit the txt and doc files to textarea? How can I submit the txt and doc files to textarea? There are txt and doc files, and then you want to create a button on the page. click this button to select the txt or doc file and read the contents of these files into textarea, how can I write this code when textarea submits the code to the database?


Reply to discussion (solution)

Use file_get_contents () to obtain the text content and display it in textarea.

Use file_get_contents () to obtain the text content and display it in textarea.
Can you tell me more? It is best to give code. thank you! New users do not understand.

Do you know? Thank you!

............
Buddy, you have to rely on yourself. 1 # you have already made it clear.
Let's talk about it. we did it for you, and you got it.

 Version}
"; // Set its visibility to 0 (false). If you want to enable it at the frontend, use 1 (true) // to open the application in the forefront, use 1 (true) // $ word-> Visible = 0; // hitting? $ Word-> Documents-> OPen ("d: \ myweb \ muban.doc "); // read the document content $ test = $ word-> ActiveDocument-> content-> Text; echo $ test; echo"
"; // Replace the sexinsex variable in the document with $ test = str_replace (" <{variable}> "," this is a variable ", $ test); echo $ test; $ word-> Documents-> Add (); // Add the text in the new document $ word-> Selection-> TypeText ("$ test "); // save the document in the directory $ word-> Documents [1]-> SaveAs ("d:/myweb/comtest.doc "); // close the connection to the COM component $ word-> Quit ();?>


$ File = fopen ("http: //" localhost/ttt. word "," r ";
If (! $ File ){
Echo"

; Unable to open remote file. \ n ";
Exit;
}
While (! Feof ($ file )){
$ Line. = fgets ($ file, 4096 );
}
Echo $ line;
Fclose ($ file );

Php reads word, txt, excel ......


How to combine the code you gave

............
Buddy, you have to rely on yourself. 1 # you have already made it clear.
Let's talk about it. we did it for you, and you got it.
I am a Cainiao. please try again.

You can't do it, please!

Give you a thought:
1) Let's take a look at the file_get_content () and fopen () functions. you can select one of them. how to read the txt and word functions.
2) how to bind the read value to textarea.
You have studied.

How do I feel that LZ is talking about the client?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.