antiword.php 926 B

12345678910111213141516171819202122232425262728293031323334
  1. From: Paul Southworth <pauls@etext.org>
  2. Subject: antiword PHP script
  3. Date: Thu, 24 Oct 2002 14:01:05 -0700 (PDT)
  4. Please find attached a trivial example of using a web form to process an
  5. uploaded Word doc to text using antiword. Perhaps other antiword users
  6. would find it useful.
  7. --Paul
  8. <?
  9. /* antiword.php
  10. A PHP script to convert uploaded MS Word docs to text using antiword.
  11. This script is public domain, no copyright.
  12. September 11, 2002
  13. Paul Southworth
  14. */
  15. function print_form() {
  16. ?>
  17. <html><head><title>antiword</title></head><body>
  18. <form method=post action=antiword.php enctype="multipart/form-data">
  19. <input name=upload type=file>
  20. <input type=submit name=submit value=convert>
  21. </form>
  22. </body></html>
  23. <?
  24. }
  25. if ($_FILES['upload']) {
  26. header ("Content-type: text/plain");
  27. system("/usr/local/bin/antiword " . $_FILES['upload']['tmp_name']);
  28. } else {
  29. print_form();
  30. }
  31. ?>