Exemplo n.º 1
0
<?php

/**
 * Created by Kent M. Patrick
 * Project: BPU
 * Company: Fingerprints Ltd
 * Date: 21/09/2016
 * Time: 9:58 AM
 */
require_once 'header.php';
$upload = new Uploads();
if (isset($_FILES['upload'])) {
    $upload->set_file_info($_FILES['upload']);
    $errors = $upload->file_checker();
    if (count($errors) == 0) {
        if (!is_dir($upload->dir)) {
            mkdir($upload->dir, 0777, true);
        }
        if (!move_uploaded_file($upload->file_tmp, $upload->dir . $upload->file_name)) {
            $alerts->display("danger", "error", "file failed to upload");
        } else {
            $_SESSION['upload_file'] = $upload->dir . $upload->file_name;
        }
    } else {
        unset($_SESSION['upload_file']);
        $alerts->display("danger", "error", $errors['0']);
    }
}
if (isset($_GET['step'])) {
    $form = new Forms();
    switch ($_GET['step']) {