Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter mrfunk

    (@mrfunk)

    here is my live_preview.php which generates the price $pri

    <?php
    
        include("STLStats.php");
       // include("wp_ultra_simple_shopping_cart.php");
    
        $allowedExts = array("stl");
        $extension = strtolower( end(explode(".", $_FILES["file"]["name"])) );
    //    if (($_FILES["file"]["size"] < 200000)
    //    && in_array($extension, $allowedExts))
    		if(in_array($extension, $allowedExts))
          {
            if ($_FILES["file"]["error"] > 0)
              {
                  echo "Error: " . $_FILES["file"]["error"] . "";
              }
            else
              {
                echo "<H1>STLStats report</H1>
    
    ";
                $fname = $_FILES["file"]["tmp_name"];
                $obj = new STLStats($fname);
                echo "<u><H2>STL file Report</H2></u>";
                $unit = "cm";
                $vol = $obj->getVolume($unit);
                echo "Volume: " . $vol . " cubic " . $unit . "";
                $weight = $obj->getWeight();
                echo "Weight: " . $weight . " gm";
                $den = $obj->getDensity();
                echo "Density: " . $den . " gm/cc" . "";
                $tcount = $obj->getTrianglesCount();
                echo "Triangles Count: " . $tcount . " triangles read";
                $pri = $obj->getPrice($unit);
                echo "Price: " . $pri . "  ". "";
    
                echo "";
    
              }
          }
        else
          {
            echo "File too large or bad file extension.";
          }
    
        function __autoload($class_name) {
            include 'classes/'.$class_name . '.php';
        }
    
                ?>

    [Moderator Note: Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)