<?php
include_once("../public/con_reedbean.php");
include_once ("../library/uploadImages.php");

$do = $_GET['do'];
$today = date("Y-m-d H:i:s");
$date = date('Y-m-d');
$userid = $_SESSION['userid'];

if ($do == 'uploadfile') {

    $sellbillid = filter_input(INPUT_POST, 'sellbillid');
    $handle = new upload($_FILES['imageu']);
    $images = uploadImages($handle, "../views/default/images/sellbill", 300, 300);
    $imageid = filter_input(INPUT_POST, 'imageid');
    if (!$imageid) {
        R::exec("INSERT INTO `sellbillimage`(`sellbillid`, `images`) VALUES
     ($sellbillid, '$images')");
    } else {
        R::exec("UPDATE `sellbillimage` SET `sellbillid`= $sellbillid,`images`='$images'
       WHERE id = $imageid");
    }
    echo '<img src="../views/default/images/sellbill/'. $images.'"  data-sellbill="'.$sellbillid.'"  class="clickuploadfile" style="width: 40px;height: 40px;border: 1px solid;border-radius: 6px;">';
}





?>