Example #1
0
<?php

include "DocxConversion.php";
include "../../../myDatabase.php";
$itemNo = $_GET['itemNo'];
$ro = new database();
$docObj = new DocxConversion($ro->selectNow("uploadedFiles", "fileName", "itemNo", $itemNo));
//$docObj = new DocxConversion("test.docx");
//$docObj = new DocxConversion("test.xlsx");
//$docObj = new DocxConversion("test.pptx");
echo "<br><center><img src='http://" . $ro->getMyUrl() . "/COCONUT/myImages/mendero.png' width='40%;' height='20%;'></center><br><br>";
echo "&nbsp;<b>" . $ro->selectNow("patientCharges", "description", "itemNo", $itemNo) . "</b><Br>";
echo "&nbsp;<b>" . $ro->selectNow("uploadedFiles", "dateUploaded", "itemNo", $itemNo) . "</b><Br><Br>";
echo $docText = $docObj->convertToText();
     $data = preg_replace('/[^A-Za-z0-9]/', '', $data);
     //echo $data;
     $handle = fopen("one.txt", 'w');
     fwrite($handle, $data);
     $fp->fingerPrint($file);
 } else {
     if ($extension == 'docx') {
         $docobj = new DocxConversion($file);
         $data = $docobj->convertToText();
         $data = preg_replace('/[^A-Za-z0-9]/', '', $data);
         $handle = fopen("one.txt", 'w');
         fwrite($handle, $data);
         $fp->fingerPrint($file);
     } else {
         if ($extension == 'doc') {
             $docobj = new DocxConversion($file);
             $data = $docobj->convertToText();
             $data = preg_replace('/[^A-Za-z0-9]/', '', $data);
             $handle = fopen("one.txt", 'w');
             fwrite($handle, $data);
             $fp->fingerPrint($file);
         } else {
             if ($extension = 'txt') {
                 $handle = fopen($file, 'r');
                 $data = file_get_contents($file);
                 $data = preg_replace('/[^A-Za-z0-9]/', '', $data);
                 $handle = fopen("one.txt", 'w');
                 fwrite($handle, $data);
                 $fp->fingerPrint($file);
             }
         }
 function __construct()
 {
     parent::__construct();
 }
Example #4
0
    $file = $_FILES['file']['tmp_name'];
    ///tymczasowa œcie¿ka do pliku
    if ($type == 'pdf' || $type == 'PDF') {
        $text = file_get_contents($file);
        if (!empty($text)) {
            $parser = new \Smalot\PdfParser\Parser();
            $pdf = $parser->parseFile($file);
            $text = $pdf->getText();
        }
    } else {
        if ($type == 'txt' || $type == 'TXT') {
            $text = file_get_contents($file);
            $text = translate($text);
        } else {
            if ($type == 'docx' || $type == 'DOCX') {
                $docObj = new DocxConversion($extent, $file);
                $text = $docObj->convertToText();
            }
        }
    }
}
if (isset($text)) {
    $email_list = validate($text);
    $email_list = array_unique($email_list);
    if (empty($email_list)) {
        $_SESSION['empty-list-error'] = true;
        header('Location: index.php#find-email');
        die;
    }
    if (empty($_SESSION['email_list'])) {
        $_SESSION['email_list'] = $email_list;