<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');

$doc                                  = new doc();
$uploadDir                            = '../../_docs';

if (!empty($_FILES)) {
  $tmpFile                              = $_FILES['file']['tmp_name'];
  $filename                             = $uploadDir . '/doc-' . $_POST['kunden_id'] . '-' . time() . '-' . $_FILES['file']['name'];
  $filename                             = str_replace(" ", "_", $filename);
  move_uploaded_file($tmpFile,$filename);
  
  $doc->saveUploadDocs($_POST, $filename);
}

