<?php
include("../../pidbco/pidbjoin.php");

if(isset($_FILES['file']))
{
    $ord1_id = strip_tags(base64_decode($_POST['od1']));
    $name1 = $_FILES['files']['name'];
    $tmp_name1 = $_FILES['files']['tmp_name'];
    $type_name1 = $_FILES['files']['type'];
    $error1 = $_FILES['files']['error'];

    if(!empty($name))
    {

        $date=date('Y-m-d ');

        for($i=0;$i<count($tmp_name1);$i++)
        {

            $u_name1= time().'_'.rand(100,999).$name1[$i];
            move_uploaded_file($tmp_name1[$i],'../material-uploads/'.$u_name1);
            mysqli_query($con,"INSERT INTO ord_materials(ord_id, upload_date, datas) VALUES ('$ord1_id','$date','$u_name1')");
            ?><script>window.location.href="Marketing-Order-Details";</script><?php

        }

    }
    else
    {
        ?><script>alert('Error..!');</script><?php
    }

}

?>