Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia Document Converter Pro code samples
Example 1: How to convert a file (submitFile method) from PHP  Print Example 
  • Copy the following PHP scripts (main.php, checkstatus.php, error.php and done.php) into your web site root.

Main.php
<?php

  // set where you want to store the uploaded files
  // in this example we keep file in folder tmpUpload
  $tmpFldr = realpath("./tmpUpload");

  if (!empty($_FILES['myFile']['name'])) {

    $DC = New COM("Neevia.docConverter");
    $docID = $DC->GUID;

    $path = $tmpFldr ."\\". $docID . $DC->getExtensionName( $_FILES['myFile']['name'] );

    print $path;

    if (move_uploaded_file($_FILES['myFile']['tmp_name'], $path))
    {
       $DC->setParameter("DocumentOutputFolder", realpath(".") );

       $rVal = $DC->submitFile( $path, "" );

       $DC->fileDelete( $path );

       if ($rVal != 0 ) {
         header("Location: error.php");
       }else{
         header("Location: checkStatus.php?docID=" . $docID . $DC->getExtensionName($path));
       }
    }
  }

?>
<HTML>
<HEAD>
  <TITLE>Neevia Document Converter Pro sample file</TITLE>
</HEAD>
<BODY><CENTER>
<FORM action="main.php" method="post" enctype="multipart/form-data">
Select File: <INPUT type="file" name="myFile"><BR>
<INPUT type="submit" name="submit" value="Convert">
</FORM>
</BODY>
</HTML>
checkStatus.php
<?php
  $DC = New COM("Neevia.docConverter");

  $DC->setParameter("DocumentOutputFolder", realpath("."));

  $docID=$_REQUEST["docID"];

  $rVal = $DC->checkStatus($docID, "");
  if ($rVal==0){
    header("Location: done.php?docID=". $DC->getBaseName( $docID ));
  } else {
    if ($rVal != 2) { header("Location: error.php"); }
  }
?>
<HTML>
<HEAD>
 <TITLE>Neevia.com</TITLE>
 <META HTTP-EQUIV="refresh" CONTENT="2">
</HEAD>
<BODY><BR><BR><CENTER>
<H1>CONVERTING - PLEASE WAIT!!!</H1>
</BODY>
</HTML>
error.php
<HTML>
<BODY><BR><BR><CENTER>
<H1>THERE WAS AN ERROR CONVERTING THE DOCUMENT</H1>
</BODY>
</HTML>
done.php
<HTML>
<BODY topMargin="0" leftMargin="0" scroll="no">
<EMBED src="<?php echo $_REQUEST["docID"] . ".pdf" ?>" width="100%" height="100%" 
       fullscreen="yes">
</BODY>
</HTML>



Copyright © 1999-2016 Neevia Technology. All Rights Reserved. Home | Products | Technical Support | About Us | Contact Us