Example #1
0
<?php

/**
 * @name Ajax Rquests
 * @copyright Darius Matulionis
 * @author Darius Matulionis <*****@*****.**>
 */
//UPLOADIFY SESSION AUTH
//!!!! CHANGE THIS IF NEDED!!!!!!
if (!empty($_FILES) && isset($_FILES['Filedata']) && $_REQUEST['hash']) {
    require 'EncriptDecript.php';
    $ed = new EncriptDecript();
    $session_id = $ed->decript($_REQUEST['hash']);
    $_COOKIE['PHPSESSID'] = $session_id;
    session_id($session_id);
    session_start();
    $_SESSION['user_auth'] = true;
}
require_once 'config.php';
require_once 'FilesHandler.php';
$filesHandler = new FilesHandler();
//FILES UPLOAD UPLOADIFY
if (!empty($_FILES) && isset($_FILES['Filedata'])) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $sub_dircetory = null;
    if ($_REQUEST['dir']) {
        $sub_dircetory = $_REQUEST['dir'] . "/";
    }
    $targetPath = UPLOADS_PATH . DIRECTORY_SEPARATOR . $sub_dircetory;
    $targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name'];
    move_uploaded_file($tempFile, $targetFile);