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?